Jump to content

Funce

Moderator
  • Posts

    602
  • Joined

  • Last visited

  • Days Won

    19

Posts posted by Funce

  1. Hmm.. This is interesting because on its own, the code for your top bar works fine. But when you put that code one after the other, the second set of styles override the first.

    Have you tried adding separate classes for each navigation and styling them?

  2. Hi @Rewillis

    You've missed out one character! Make sure you have the = character after the first % sign so that the @DateTime.Now is outputted rather than only being evaluated.

    <p>The time is <%= @DateTime.Now %></p>

     

  3. Well I imagine you can use the info from both of these tutorials to figure out the login form.

    PHP Form Handling - https://www.w3schools.com/php/php_forms.asp

    CSS Login Form - https://www.w3schools.com/howto/howto_css_login_form.asp

     

    Our SQL section can handle your Database questions.

    https://www.w3schools.com/sql/default.asp

    Here's the hosting section if you want to figure out what database you want that W3 have tutorials on.

    https://www.w3schools.com/sql/sql_hosting.asp

  4. There's nothing odd with this one. You're missing the fact that the program checks for two things

    • Valid URL (FILTER_VALIDATE_URL)
    • Has a query string (FILTER_FLAG_QUERY_REQUIRED)

    "https://www.w3schools.com" is a valid URL, but lacks a query string and therefore does not succeed the check.

  5. You could use a For loop in combination with document.getElementsByClassName

    And add a class to all the elements you want disabled together.

    <h2>ClassName For Loop</h2>
    
    <label><input onchange="some_function(this);" type="checkbox" checked>Check</label>
    <input type="text" class="some-class">
    <input type="text" class="some-class">
    <input type="text" class="some-class">
    <input type="text" class="some-class">
    <input type="text" class="some-class">
    <input type="text" class="some-class">
    <input type="text" class="some-class">
    <input type="text" class="some-class">
    <input type="text" class="some-class">
    <input type="text" class="some-class">
    
    <script>
    function some_function(letterCheckBox) {
      var element_list = document.getElementsByClassName("some-class");
      let element_length = element_list.length;
      let element_disable = !letterCheckBox.checked;
      for (let i = 0; i < element_length; i++) {
        element_list[i].disabled = element_disable;
      }
    }
    </script>
    
    </body>
    </html>

     

  6. To answer your float/double question, decimal numbers don't have infinite accuracy due to their representation in binary. As you can see you're 0.000000000001 out due to that. This is usually why choosing your data type and rounding appropriately are important. Different data types have different accuracies.

    Your third question seems like there's something else underneath which you aren't asking. I'll answer it as generally as possible. Method Overloading like that is used for when you want to use one function for multiple different data types, or different amounts of them, and you require it to be handled differently per case.

    Easiest way to see it in action is the '+' operator.

    String x = "32" + "4";
    System.out.println(x); // Outputs 324
    int y = 2 + 4;
    System.out.println(y); // Outputs 6

    Two strings concatenate, two numbers add together. With an overload for every combination of data types that "+" can support.

  7. I can haphazard a guess, that you haven't put quotes around your string.

    You also may want to directly include the error, because an "error" could possible be your internet being offline.

×
×
  • Create New...