- 1、本文档共14页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
身份证验证.js javascript 代码(代码 身份证验证.js javascript)
身份证验证.js javascript 代码(代码 身份证验证.js javascript)
/ * *
* id 15 bit encoding rules: dddddd, yymmdd, XX, P
* dddddd: area code
* yymmdd: date of birth
* xx: sequence class encoding cannot be determined
* p: sex, odd number is male, even number is female
* p /
* id 18 bit encoding rules: dddddd, yyyymmdd, XXX, y
* dddddd: area code
* yyyymmdd: date of birth
* xxx: sequence class encoding cannot be determined. Odd numbers are males and even numbers are females
* y: check code, which can be computed by the first 17 bits
* p /
* 18 digit weighting factors are (right to left), Wi = [7, 9, 10, 8, 4, 2, 1, 6, 3, 7,, 9, 10, 5, 5, 8, 4,].]
* authentication bits Y = [1, 0, 10, 9, 8, 7, 6,, 5, 4, 3, 2]
* parity check formula: Y_P = mod (sigma (Ai * Wi), 11)
* I is the number 2 to 18 from the right to left of the ID number; Y_P is the location of the check code array for the foot check code
*
* /
Function checkParseIdCard (VAL) {
Var Val = trim (Val);
Var MSG = checkIdcard (Val);
If (MSG = = verify through) {
Alert (MSG);
Return;
}
Var birthdayValue;
Var sexId;
Var sexText;
Var age;
If (15 = = val.length) {//15 identity card number
BirthdayValue = val.charAt (6) + val.charAt (7);
If (parseInt (birthdayValue) 10) {
BirthdayValue =20+ birthdayValue;
} else {
BirthdayValue =19+ birthdayValue;
}
BirthdayValue = birthdayValue + - val.charAt + (8) + val.charAt (9)
+ + + - val.charAt (10) val.charAt (11);
If (parseInt (val.charAt (14) / 2) * 2 = = val.charAt (14)) {
SexId = 1;
SexText = male;
} else {
SexId = 2;
SexText = female;
}
}
If (18 = = val.length) {//18 identity card number
BirthdayValue = val.charAt (6) + val.charAt (7) + val.charAt (8)
Val.charAt + + + val.charAt (9) - (10) + val.charAt (11 +) -
+ val.charAt (12) + val.charAt (13);
If (parseInt (val.charAt (16) / 2) * 2 = = val.charAt (16)) {
SexId = 1;
SexText = male;
} else {
SexId = 2;
SexText = female;
}
}
/ / age
Var dt1 = new Date (birthdayValue.replace (-, / / ));
Var DT2 = new, Date ();
Var age = dt2.getFullYear () -
您可能关注的文档
- 纸尿裤文章——第五期(Diapers article - Fifth).doc
- 纸张尺寸及照片尺寸(Paper size and photo size).doc
- 纳米材料(Nanometer material).doc
- 纹章学1(Art of arms 1).doc
- 线代知识点(Line generation knowledge point).doc
- 线性代数习题解答赵树嫄(Linear algebra answers Zhao Shuyuan).doc
- 线性代数复习知识(Review knowledge of linear algebra).doc
- 线性代数复习提纲(重要公式,方法)(Linear algebra (important formula method)).doc
- 线性代数感悟(Linear algebra perception).doc
- 纳税大户(big taxpayer).doc
文档评论(0)