ShuDudu's Home was started in 2011, but the web data is lost, so now begin again, I would like to make some friends, I hope you like ShuDudu's home.
Current position: ShuDudu > Life >

ASP ID number verification function

Monday on November 7th, 2005Life

ASP ID card number verification function

from: Web Technology Chinese website
--

 function checkIDCard (s, d, g){If (! s) return falseD = new Date (d)If (! d.getTime ()) return falseVar t, rT = & quot;" + d.getFullYear () + dblNum (d.getMonth () + 1) + dblNum (d.getDate ())If (g = = null | | isNaN (g)) return falseG = parseInt (g) 2Switch (s.length){Case 8:If (new Date () & gt; d.setFullYear (d.getFullYear () + 19)) return falseR =/^ [\ d] {8} $/If (! r.test (s)) return falseIf (s! = t) return falseBreakCase 15:R =/^ [\ d] {15} $/If (! r.test (s)) return falseIf (s.substr (6,6)! = t.substr (2)) return falseIf (parseInt (s.charAt (14))% 2! = g) return falseBreakCase 18:R =/^ (?: [\ d] {18} | [\ d] {17} X) $/IIf (! r.test (s)) return falseIf (s.substr (6,8)! = t) return falseIf (parseInt (s.charAt (16))% 2! = g) return falseVar n = 0Var w = new Array (7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);Var c = new Array (& quot;1", & quot;0", & quot;X", & quot;9", & quot;8", & quot;7", & quot;6", & quot;5", & quot;4", & quot;3", & quot;2");//check codeFor (var I = 0; I & lt; 17; iTunes +){N + = parseInt (s.charAt (I)) * w [I]}If (s.charAt (17) .toUpperCase ()! = c [n% 11]) return falseBreakDefault:Return false}Return true}Function dblNum (n){Return parseInt (n) & lt; 10? & quot;0" + n: n}//var sss = & quot;422324860305482"/Response.Write (checkIDCard (sss, & quot;03/05/1986", 0)); 

Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/life/ASP-ID-number-verification-function.htm