The ID card can identify a person's information. The following describes how to use JavaScript to obtain the age and gender ID card of the person using the ID card number to identify a person's information, the following describes how to use JavaScript to obtain the age and gender of the client through the ID card number.
Script function IdCard (UUserCard, num) {if (num = 1) {// Get birth date birth = UUserCard. substring (6, 10) + "-" + UUserCard. substring (10, 12) + "-" + UUserCard. substring (12, 14); return birth;} if (num = 2) {// Obtain the gender if (parseInt (UUserCard. substr (16, 1) % 2 = 1) {// male return "male";} else {// female return "female ";}} if (num = 3) {// Obtain The Age var myDate = new Date (); var month = myDate. getMonth () + 1; var day = myDate. getDate (); var age = myDate. getFullYear ()-UUserCard. substring (6, 10)-1; if (UUserCard. substring (10, 12) <month | UUserCard. substring (10, 12) = month & UUserCard. substring (12, 14) <= day) {age ++;} return age ;}} alert (IdCard ('000000', 3); script
The following code is used to obtain the age and gender of a person using the ID card number.
The code example is as follows:
Foot home