Javascripts > Javascript Forms > EMail Address Verification
Script Title: EMail Address Verification
Description: If you ask for the e-mail address to the user in any textfield on a form, this script verifies whether the text entered in the field is in the format user@domain.com
Example: Available
Copy the following code into your <HEAD></HEAD> tags.<script language="JavaScript"> var result function checkemail(){ var str=document.mailcheck.emailaddress.value var filter=/^.+@.+\..{2,3}$/ if (filter.test(str)) result=true else { alert("Please input a valid email address!") result=false } return (result) } </script> <script> function checkall(){ if (document.layers||document.all) return checkemail() else return true } </script>
Copy the following code INTO your <BODY> tag.onSubmit="return checkall();"
Copy the following code between the <BODY></BODY> tags of your html page.<form name="mailcheck" onSubmit="return checkall()"> Please input a valid email address:<br> <input type="text" size=18 name="emailaddress"> <input type="submit" value="Submit"> </form>
Enter your name and email address to have this script sent right to your Inbox for later viewing. First Name Last Name Email