JS Form validation issue
<p>I am new to JS ! This is my first program. It validates that the text field shouldn't be null. I tried everthing but nothing seems to work.</p>

<pre><code>&lt;script type="text/javascript"&gt;
    var data_age = document.getElementById("ages") ;

    function check() {
        if (data_age==null) {
            alert("no data") ;
            return false ;
        } else {
            return true ;
        }   
    }
&lt;/script&gt;


&lt;form name="frm" action="a.php" method="post" onsubmit="return check(this)"&gt;
&lt;input type="text" name="age" id="ages"&gt;
&lt;input type="submit" value="submit"&gt;
&lt;/form&gt;
</code></pre>
