function validEmail(myId,errorMessage)
{
var email = /^[_a-zA-Z0-9+.]+@([_a-zA-Z0-9]+.)+[a-zA-Z0-9]{2,3}$/;
if(email.test(document.getElementById(myId).value))
{
return true;
}
else
{
window.alert(errorMessage);
document.getElementById(myId).focus();
return false;
}
}
转载于:https://www.cnblogs.com/shengel/archive/2009/01/04/1367832.html