function checkMsg(){
var name = document.getElementById("name").value;
var checkChinese=/[\u4e00-\u9fa5]/;
var checkName=name.match(checkChinese);
var tel=document.getElementById("tel").value;
var checkNum=/\d{3}-\d{8}|\d{4}-\d{8} |\d{11}/;
var checkTel=tel.match(checkNum);
var email=document.getElementById("email").value;
var checkEmailName=/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
var checkEmail=checkEmailName.test(email);
if(checkName){
if(checkTel){
if(checkEmail){
return true;
}else{
alert('请输入正确的电子邮件');
return false;
}
}else{
alert('请输入正确的联系方式,固话采用“区号-号码”,手机为11位');
return false;
}
}else{
alert('用户名只能是中文');
return false;
}
}
2.php中is_numeric判断是不是数字,is_int整数
is_int接收get/post的值,有'1';就识别不了,
可以用(int) $a==$a ? 'int' : 'not int';
或者使用ceil,floor,round判断
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。