IHYPRESS.NET
JAVASCRIPT
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Earn Free Bitcoin
JavaScript ❯ Form Validation 1
<13>
<html> <head> <script> function notEmpty(elem, helperMsg){ if(elem.value.length == 0){ alert(helperMsg); elem.focus(); return false; } return true;} </script> </head> <body> <form> Field #1: <input type="text" id="zone1" value="This field has text in it" /><br> Field #2: <input type="text" id="zone2" value="" /><br><br> <input type="button" onclick="notEmpty(document.getElementById('zone1'), 'sorry... empty field')" value="Check Field #1" /><br> <input type="button" onclick="notEmpty(document.getElementById('zone2'), 'sorry... empty field')" value="Check Field #2" /> </form> </body>
Field #1:
Field #2:


COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.