Andy-H Posted August 11, 2008 Share Posted August 11, 2008 Is there a JavaScript function (like the PHP !ctype_alnum()) to test if a string is alphanumeric. Also how do I test for a valid email address. Thanks for any help. Quote Link to comment Share on other sites More sharing options...
jithavijayan Posted August 11, 2008 Share Posted August 11, 2008 if(document.form.email.value!=null||document.form.email.value!="") { email1 = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/; if(!email1.test(document.form.email.value ) ) { alert("Please enter the correct email address"); document.form.email.value=""; document.form.email.focus(); return false; } } You can validate e-mail like this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.