Jump to content

Search the Community

Showing results for tags 'empty'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 7 results

  1. Hello, I've just read the tutorial on how to process a form in PHP, available on this site, and I was wondering if there's a specific reason to declare empty variables (or arrays) at the beginning? I don't understand what is the point of doing so. For example, in the following code, why would the 2sd and 3rd lines be necessary? <?php $errors = []; $name = $email = $message = ''; if (condition) { $errors['name'] = 'alert'; } else { $name = sanitize_input($_POST['name']); if (new_condition, $name) { $errors['name'] = 'new alert'; } }
  2. Dear all; Is there any technical difference between initially setting a variable to false or setting it to an empty value at the beginning of a script, i.e., $x = false; vs $x='';
  3. Hello everyone In the first bullet point of the chapter summary on HTML attributes (bottom of the page) it is stated: "All HTML elements can have attributes". Am I misunderstanding that by thinking empty elements can also have attributes? I tried to verify this by writing: (XHTML) <br title="test"/>or<br title="test"></br> or (standard HTML) <br title="test"> only to watch it not work as per my expectation because no tooltip is shown, however I hover over the document (code author: Mrw3c). Last I checked on the section about HTML elements, it does not say if an attribute is considered content or not. It only says the text between the start tag and the end tag is content and as far as I know, attributes are meta information, meaning they are not content. Of course, w3schools states an attribute 'provides extra information' so I could deduct that indeed means meta information. Aside from that, I checked the w3schools documentation on the <br> tag: and it says "The <br> tag is an empty tag which means that it has no end tag". Nonetheless, it does say that the <br> tag supports global attributes such as the 'title' attribute. However, as you can see above, I tried that but unfortunately it did not work for me. Am I missing something in my understanding? Thanks
  4. I'd like to hide the corresponding button when an input value is empty or has a value="n/a". In the following example, the input box "first_field" is corresponding with the button "first_button", and the input box "second_field" with the button "second_button", and so on... In this case the second and fifth button will be hidden: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Hide Button When Input Value Is Empty</title></head><body> <div> <form action=""> <fieldset> <input type="text" id="first_field" value="1"/> <input type="text" id="second_field" value=""/> <input type="text" id="third_field" value="3"/> <input type="text" id="fourth_field" value="4"/> <input type="text" id="fifth_field" value="n/a"/> <input type="text" id="sixth_field" value="5"/> </fieldset> </form> </div> <div> <form action=""> <fieldset> <div id="first_button"><input type="button" value="First Button"/></div> <div id="second_button"><input type="button" value="Second Button"/></div> <div id="third_button"><input type="button" value="Third Button"/></div> <div id="fourth_button"><input type="button" value="Fourth Button"/></div> <div id="fifth_button"><input type="button" value="Fifth Button"/></div> <div id="sixth_button"><input type="button" value="Sixth Button"/></div> </fieldset> </form> </div></body></html> Anyone know a Javascript that can do this?
  5. HEllo i am working on a site, but it is not uploaded so i will only post the code here for help. It is about a big large empty space, almost twice as large as the page were all the design is, maybe it goes out of the container too but i am not sure. So what do i need to do, or to remove in css for it to be ok. I notice that when i remove the "meny"boxes "wich are located to the left) the site becomes fine, but when they are there this empty space is coming up :/. What do i need to do? There are 2 css files. The one named pse5menyset.css is the one with the menys to the left you need to look into for helping me i guess! thank you pse.css index5.html pse5menyset.css
  6. The idea:The idea is to automatically fill the fields with "user@mail.com" and "password" if they're left blank. The problem:Well, the Javascript check is working and doing what it is supposed to. However, if the user adds a value, and then erases that value leaving the input empty, the script doesn't detects the field as empty... although the value returned is indeed empty like "". The code: function loginFormToggleFillers(element){ var loginF = document.loginForm.login; var user = loginF.value; var passwordF = document.loginForm.password; var password = passwordF.value; if(element){ el = element.attributes["name"].value; if( el == "login" ){ if ( user == "" || user.length == 0 ){ loginF.setAttribute("value", "user@mail.com"); } if ( user == "user@mail.com" ){ loginF.setAttribute("value", ""); } } else if ( el == "password" ){ if ( password == "" || password.length == 0 ){ passwordF.setAttribute("value", "password"); } if ( password == "password" ){ passwordF.setAttribute("value", ""); } } } else { if ( user == "" || user.length == 0){ loginF.setAttribute("value","user@mail.com"); } if ( password == "" || password.length == 0){ passwordF.setAttribute("value","password"); } }}loginFormToggleFillers(null); The HTML call (wrote by hand, so there might be a mistake somewhere... but it's just the idea): <input type="text" name="login" onFocus="loginFormToggleFillers(this)" onBlur="loginFormToggleFillers(this)" /><input type="password" name="password" onFocus="loginFormToggleFillers(this)" onBlur="loginFormToggleFillers(this)"/> Any ideas on this? Thanks in advance!
  • Create New...