IHYPRESS.NET
JAVASCRIPT
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Earn Free Bitcoin
JavaScript ❯ Form Validation 2
<14>
<!DOCTYPE html> <html lang="en"> <head> <script> function isNumeric(elem, helperMsg){ var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } </script> </head> <body> <form> Field #1: <input type="text" id="zone1" value="5674747574"><br> Field #2: <input type="text" id="zone2" value="222-333-333"><br> Field #3: <input type="text" id="zone3" value="dgfthekdg"><br><br> <input type="button" onclick="isNumeric(document.getElementById('zone1'), 'not only numeric')" value="Check Field #1"><br> <input type="button" onclick="isNumeric(document.getElementById('zone2'), 'not only numeric')" value="Check Field #2"><br> <input type="button" onclick="isNumeric(document.getElementById('zone3'), 'not only numeric')" value="Check Field #3"> </form> </body>
Field #1:
Field #2:
Field #3:



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