js正则表达式验证身份证号

var regIdNo = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
var idcard = '2837288383863';//身份证号码
if(!regIdNo.test(idcard)){  
    alert('身份证号填写有误');  
    return false;  
}

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: