javascript if else statement error
<p>I am trying to check if the name text field is empty.  if it is, then i want to show a  div that says "please enter your name".  i do a test, and name='name'.  but after that, nothing else pops up.  </p>

<pre><code>function validate(input, name) {
if(name=='name') {
        if(input==null || input=="") {
            name.style.visibility='visible';
            alert("please enter a value");
        } else {
            alert("valid entry.");
        }
    }
}
</code></pre>

<p>when I print out input with the alert box, it does not contain anything; so I know that it is either null or "".  how do i fix this so that it works?</p>

<p>here is my text field:</p>

<pre><code>&lt;input type="text" name="name" id="name" onblur="javascript: validate(this.value, this.id);" required /&gt;
    &lt;div id="name" style="visibility:hidden; float:right;"&gt;Please fill in a name!&lt;/div&gt;
</code></pre>
