时间:2021-07-01 10:21:17 帮助过:8人阅读
function check(){
var email=document.getElementById("email").value;
var isemail=/^[a-z]([a-z0-9]*[-_]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[\.][a-z]{2,3}([\.][a-z]{2})?$/i;
if (email=="") {
alert("请输入您的邮箱!");
return false;
}
if (email.length>25){
alert("长度太长");
return false
}
if (!isemail.test(email)){
alert("不是邮箱");
return false;
}
}以上就是js校验邮箱方法的一种写法的详细内容,更多请关注Gxl网其它相关文章!