JavaScript advice
bbcompent1 | Posted 12:00am 8. May 2009 Server Time |
Since my captcha won't work I figured at least having folks enter valid information may help cut down the junk. Anyway, in trying to validate the email address, it checks the name and phone number just fine. When I try to check the email, it just blows right by and doesn't check anything. Here's my code, please help!
<script language="javascript" type="text/javascript">
function formvalidation()
{
if (formContact.txtName.value == "")
{
alert("Please enter your name");
return false;
}
else if (formContact.txtPhone.value == "")
{
alert("Please enter your phone #");
return false;
}
else if (formContact.txtemail.value.search(/^[^@]+@[^@]+.[a-z]{2,}$/i) == -1)
{
alert('A valid e-mail address is required.\nPlease try again');
return false;
}
else
{
return true;
}
}
</script> |
|
|