IHYPRESS PROGRAMMING
Tutorials and JavaScript programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
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>
Hergestellt in Deutschland / Made in Germany
Field #1:
Field #2:
Field #3:



COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland