<html>
<head>
<title>Full E-Mail Validation</title>
<script>
function emailtest() {
//created a var 'ketan' to call document.formName once, after this initial instance call, every time you want to call document.formName just call ketan. (ex: ketan.fieldName.value == "" is same as document.formName.fieldName.value == "")
var ketan = document.testing
//this IF will check to make sure the email field has an @ and an . in it (hence the makeup of an email address) and it will make sure the field is not blank, before submitting.
if (ketan.email.value.indexOf("@") == -1 || ketan.email.value == "" || ketan.email.value.lastIndexOf(".") == -1) {
alert("Please include a proper email address. Ex: name@ISP.com");
ketan.email.focus();
return false;
}
}
</script>
</head>
<body>
<form name="testing" action="" method="post" onSubmit="return emailtest()">
<input type="text" name="email" /><br><br>
<input type="Submit" name="Submit" value="Submit" />
</form>
<p>Enter something into the field that is not conform to an email, try to submit, see what happens.</p>
</body>
</html>