i am using javascript coding on jsp page. i want that the phone number entered by person should be in numeric only..can i get code for it?
will anyone reply????
<html> <script> function validate(){ var ph=document.getElementById('phone').value; var regExpObj = /^[0-9]+$/; if(ph==""){ alert("Enter Phone Number!"); } else if(regExpObj.exec(ph) == null){ alert('Invalid Phone Number!'); return false; } else { return true; } } </script> <form id="form" method="post" onsubmit="javascript:return validate();"> Phone Number:<input type="text" id="phone"><br> <input type="submit" value="Submit"> </form> </html>
thankyouuuuu...it was so helpful :)
Ads