Last Update:2017-08-24
Source: Internet
Author: User
Keywords
Web page production
Ajax
javascript
Take to the grand, so the copyright belongs to Shanda Online all
Function nunber () { var idcard=document.getelementbyid (' U_nunber '). Value; var errors= New array ("Verify through!", "ID card number is not correct!", "The date of birth is out of range or contains illegal characters!", "ID card number Error!", "Identity card area illegal!"); &NBSP;VAR&NBSP;AREA={11: "Beijing", 12: "Tianjin", 13: "Hebei", 14: "Shanxi", 15: "Inner Mongolia", 21: "Liaoning", 22: "Jilin", 23: "Heilongjiang", 31: "Shanghai", 32: "Jiangsu", 33: "Zhejiang" , 34: "Anhui", 35: "Fujian", 36: "Jiangxi", 37: "Shandong", 41: "Henan", 42: "Hubei", 43: "Hunan", 44: "Guangdong", 45: "Guangxi", 46: "Hainan", 50: "Chongqing", 51: "Sichuan", 52: "Guizhou", 53: " Yunnan ", 54:" Tibet ", 61:" Shaanxi ", 62:" Gansu ", 63:" Qinghai ", 64:" Ningxia ", 65:" Xinjiang ", 71:" Taiwan ", 81:" Hong Kong ", 82:" Macao ", 91:" Foreign "} var Idcard,y,jym; var S,M; var idcard_array = new array (); idcardidcard_array = idcard.split (""); if (Area[parseint (Idcard.substr (0,2))]==null) { document.getelementbyid (' nunber_re '). Innerhtml= "<div class= ' re ' ><p class= ' tipserror ' ><img src= ' images/b.gif ' class= ' iconerror ' /> ' +errors[4]+ ' </p></div> '; return false; &NBSP} switch (IDCard.length) { case 15: if ( parseint ( Idcard.substr (6,2)) +1900 % 4 == 0 | | ((parseint (Idcard.substr (6,2)) +1900 % 100 == 0 && (parseint ( Idcard.substr (6,2)) (+1900) % 4 == 0 )) { ereg=/^[1-9][0-9] {5} [0-9] {2} ((01|03|05|07|08|10|12) (0[1-9]|[ 1-2][0-9]|3[0-1]) | (04|06|09|11) (0[1-9]| [1-2] [0-9]|30) |02 (0[1-9]|[ 1-2][0-9]) [0-9]{3}$/; } else { ereg=/^[1-9][0-9]{5}[0-9]{2} (01|03|05 |07|08|10|12) (0[1-9]|[ 1-2][0-9]|3[0-1]) | (04|06|09|11) (0[1-9]| [1-2] [0-9]|30) |02 (0[1-9]|1[0-9]|2[0-8])) [0-9]{3}$/; &NBSP;&NBSP;&NBSP;&NBSP} if (Ereg.test (Idcard)) { document.getElementById (' Nunber_re '). innerhtml= "<div class= ' re ' ><p class= ' TipsSuc ' >< Img src= ' images/b.gif ' class= ' iconsuc ' /> "+errors[0]+" </p></div>; return true; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP} else { document.getElementById (' Nunber_re '). innerhtml= "<div class= ' re ' ><p class= ' TipsError ' > <img src= ' images/b.gif ' class= ' iconerror ' /> ' +errors[2]+ ' </p></div> '; return false; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP} break; case 18: &NBSP;&NBSP;&NBSP;&NBSP;//18 bit ID number detection if ( parseint (Idcard.substr (6,4)) % 4 == 0 | | (parseint Idcard.substr (6,4)) % 100 == 0 && parseint (idcard.substr (6,4)) %4 == 0 )) { ereg=/^[1-9][0-9]{5}19[0-9]{2} (01|03|05|07|08|10|12) (0[1-9) | [1-2] [0-9]|3[0-1] | (04|06|09|11) (0[1-9]| [1-2] [0-9]|30) |02 (0[1-9]|[ 1-2][0-9]) [0-9]{3}[0-9xx]$/; } else { ereg=/^[1-9][0-9]{5}19[0-9]{2} (01|03|05|07|08|10|12) (0[1-9]|[ 1-2][0-9]|3[0-1]) | (04|06|09|11) (0[1-9]| [1-2] [0-9]|30) |02 (0[1-9]|1[0-9]|2[0-8])) [0-9]{3}[0-9xx]$/; &NBSP;&NBSP;&NBSP;&NBSP} if (Ereg.test (Idcard)) { s = (parseint (idcard_array[0]) + parseint (idcard_array[10)) * 7 + (parseint (idcard_array[1]) + parseint (idcard_array[11)) * 9 + (parseint (idcard_array[2]) + parseint (idcard_array[12)) * 10 + (parseint (idcard_array[3]) + parseint (idcard_array[13)) * 5 + (parseint (idcard_array[4)) + parseint (idcard_array[14)) * 8 + (parseint (idcard_array[5)) + parseint (Idcard_ ARRAY[15]) * 4 + (parseint (idcard_array[6)) + parseint (idcard_array[16)) * 2 + parseint (idcard_array[7]) * 1 + parseint (Idcard_array[8]) * 6 + parseint (Idcard _ARRAY[9]) * 3 ; Y = S % 11; M = "F"; JYM = "10x98765432"; m = jym.substr (y,1); if (m == idcard_array[17]) { document.getElementById (' Nunber_re '). innerhtml= "<div class= ' re ' ><p class= ' TipsSuc ' >< Img src= ' images/b.gif ' class= ' iconsuc ' /> ' +errors[0]+ ' </p></div> '; return true; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP}   else { document.getelementbyid (' nunber_re '). innerHTML= "<div class= ' re ' ><p class= ' tipserror ' ><img src= ' images/b.gif ' class= ' iconError ' /> "+errors[3]+" </p></div>; return false; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP} else { document.getelementbyid (' Nunber_re '). innerhtml= "<div class= ' re ' ><p class= ' Tipserror ' ><img src= ' images/b.gif ' class= ' iconerror ' /> ' +errors[2]+ ' </p></div > "; return false; &NBSP;&NBSP;&NBSP;&NBSP} break; default: document.getelementbyid (' nunber_re '). Innerhtml= "<div class= ' re ' ><p class= ' tipserror ' ><img src= ' images/b.gif ' Class= ' IConerror ' /> ' +errors[1]+ "</p></div>"; return false; &NBSP} }