Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email validation

Status
Not open for further replies.

petenyce105

Programmer
Feb 3, 2004
12
US
im trying to validate a email address. im using this function and returning me a error

<script language=&quot;javascript&quot;>
Function email()
if (ereg('^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-z0-9\-\.]+$'))
return true;
else
return false;
}
</script>

if(!email(document.registerForm.email.value)) {
alert(&quot;Phone number must include area code.&quot;);
document.registerForm.email.focus();
return;
}


something wrong with this any help or a email script would work?
 
try this


function checkEmail(f){// f = form element

var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(f.value))
return true;
return false;

}


simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top