Saturday, 9 June 2012

email validation function


function emailValidate()
{
alert("hhhhhhhhhhhhhhhhh");

var email = document.getElementById('emailaddressID');

var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email.value))
//The test() method tests for a match in a string.
This method returns true if it finds a match, otherwise it returns false
{
alert('Please provide a valid email address');

email.focus();
return false;
}

No comments:

Post a Comment