//证件号码校验
function isIdentifyNumber(obj,id){ var selectValue = document.getElementById(id).value; //获取select框的值判断选择的类型进行校验 if(selectValue =='01'){ var isIDCard=/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/; if(obj.value!=""&&!isIDCard.test(obj.value)){ alert("请输入合法身份证号。"); obj.value=""; obj.focus(); return false; } } }//手机号及电话校验
function isPhone(obj){ var mobileRegx=/^0?(13[0-9]|15[012356789]|18[0236789]|14[57])[0-9]{8}$/; var phoneRegx =/^(([0+]d{2,3}-)?(0d{2,3})-)(d{7,8})(-(d{3,}))?$/; var nm=obj.value; if(obj.value!=""&&!mobileRegx.test(nm)&&!phoneRegx.test(nm)){ alert('请输入正确的手机号或电话号。'); obj.value=""; obj.focus(); return false; } }