function CheckEmail() {
//获取用户输入的邮箱地址相关的信息
var EmailString = document.getElementById("email").value;
var strLength = EmailString.length;
var index1 = EmailString.indexOf("@");
var index2 = EmailString.indexOf(".", index1);
var msg;
//返回相关的验证信息
if (index1 == -1 || index2 == -1 || index2 <= index1 + 1 || index1 == 0 || index2 == strLength - 1)
{
msg = "邮箱地址不合法!";
alert(msg);
return false;
}
return true;
}
转载于:https://www.cnblogs.com/wuxiaoqian726/articles/1918648.html