function checkMsg(){@H_404_1@
var name = document.getElementById("name").value;@H_404_1@
var checkChinese=/[\u4e00-\u9fa5]/;@H_404_1@
var checkName=name.match(checkChinese);@H_404_1@
@H_404_1@
var tel=document.getElementById("tel").value;@H_404_1@
var checkNum=/\d{3}-\d{8}|\d{4}-\d{8} |\d{11}/;@H_404_1@
var checkTel=tel.match(checkNum);@H_404_1@
@H_404_1@
var email=document.getElementById("email").value;@H_404_1@
var checkEmailName=/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;@H_404_1@
var checkEmail=checkEmailName.test(email);@H_404_1@
@H_404_1@
@H_404_1@
if(checkName){@H_404_1@
if(checkTel){@H_404_1@
if(checkEmail){@H_404_1@
return true;@H_404_1@
}else{@H_404_1@
return false;@H_404_1@
}@H_404_1@
}else{@H_404_1@
alert('请输入正确的联系方式,固话采用“区号-号码”,手机为11位');@H_404_1@
return false;@H_404_1@
}@H_404_1@
}else{@H_404_1@
return false;@H_404_1@
}@H_404_1@
}@H_404_1@
@H_404_1@
2.PHP中is_numeric判断是不是数字,is_int整数@H_404_1@
is_int接收get/post的值,有'1';就识别不了,@H_404_1@
可以用(int) $a==$a ? 'int' : 'not int';@H_404_1@
或者使用ceil,floor,round判断@H_404_1@ 原文链接:https://www.f2er.com/regex/359824.html