Using regular expressions to validate an email
<HTML> <HEAD> <TITLE></TITLE> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> function validateEmail(input) { var emailPattern = /^\w+@\w+(\.\w{3})$/ if (emailPattern.test(input)) { document.write("valid") } else { document.write("NOT valid") } } </SCRIPT> </HEAD> <BODY> <FORM> Please enter an e-mail address and click somewhere else on the page: <INPUT TYPE="text" SIZE="25" onBlur="validateEmail(this.value);"> </FORM> </BODY> </HTML>