Email Validation script
Description: This script uses regular expressions to check that a form field contains a valid email address. Note that it won't catch all invalid emails, like most similar scripts. However, for most intents and purposes, this script should serve its purpose well, by rejecting common email typos while leaving room for obscure yet valid emails to pass.
Here are some examples of valid email addresses that this script will recognize:
Note: If you discover a valid email address that this script rejects, please let us know.
Demo: Try typing in an email address below:
Step 1: Add the below script to the <BODY> section of your page:
The code above includes a sample form where this script validates the email field contained. The form looks like this:
<input name="myemail" type="text" style="width: 300px"><br/>
<input type="submit" onClick="return checkmail(this.form.myemail)" value="Submit" />
To customize this script to serve your own form(s), simply change the parts in red above to your own. More specifically, you should first give your email address field a name(ie: name="myemail"). Then, modify the submit button of the form by adding in the "onClick" portion. Remember to change "myemail" to reflect the name of your email address field.