email validation on checking for ".com"

admin

Administrator
Staff member
I have the following code that is giving me an error when I tried to add the piece on making sure the email has ".com" at the end. Otherwise, when I take out that piece of the code on checking for the string ".com", it works.
My code is as follow:
checkEmail = form.manemail.value

if ( (InStr(1,manemail,".com",vbTextCompare) = 0) || (checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.')))
{alert("You have entered an invalid email address. Please try again.");
form.manemail.select();
return false;
}
.........

The field is called "manemail". Thanks!
 
Back
Top