邮箱验证

J2EE 码拜 8年前 (2016-03-15) 1269次浏览
function foreach(){
var userPenetrationReport_emailText=$(“#userPenetrationReport_emailText”).val();
if(userPenetrationReport_emailText!=”” && userPenetrationReport_emailText.indexOf(“;”)>0){
var arremail=userPenetrationReport_emailText.split(“;”);
for(var i=0;i <arremail.length;i++){
if(arremail[i].replace(/\s+/g,””).search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==-1){
Prompt(“邮箱格式错误!”);
}
}
}else{
if(userPenetrationReport_emailText.replace(/\s+/g,””).search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==-1){
Prompt(“邮箱格式错误!”);
}else{
$(“#userPenetrationReport_query_form_email”).val(userPenetrationReport_emailText);
$(“#userPenetrationReport_query_form”).form(“submit”, {
url : “${ctx}/userReport/sendEmailUserPenetrationReport.do”,
success : function(r) {
if(typeof(r)==”string”){
r=eval(“(“+r+”)”);
}
if(r.success){
Prompt(“邮件已发送!”);
$(“#userPenetrationReport_sendEmailBtn”).dialog(“close”);
}else {
Prompt(“发送邮件失败:”+r.msg);
return false;
}
},
error:function(){
Prompt(“发送邮件出现错误!”);
}
});
}
}
}
假如有一个邮箱错误就阻止全部邮箱的发送
解决方案

35

格式错误直接return!

5

引用:

格式错误直接return!

同意


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明邮箱验证
喜欢 (0)
[1034331897@qq.com]
分享 (0)