JavaScript Authentication ID Number

Source: Internet
Author: User
Tags gettext

<%@ page language= "java" contenttype= "text/html; charset=gb18030 "pageencoding= "GB18030"%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >vararr2=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];vararr3=[1,0, ' X ', 9,8,7,6,5,4,3,2];functionCheckid () {varT=document.getelementbyid ("GetText"). Value; if(t.length==18){        varArr=t.split (' '); vars; varReg =/^\d+$/; varPd=0;  for(i=0;i<17;i++){            if(Reg.test (Arr[i])) {s=true; PD=arr[i]*arr2[i]+PD; }Else{s=false;  Break; }        }        if(s=true){            varR=pd%11; if(arr[17]==Arr3[r]) {document.getElementById ("Show"). Innerhtml= "ID number legal tail number:" +Arr3[r]; }Else{document.getElementById ("Show"). Innerhtml= "Non-legal identity card number"; }        }            }Else{document.getElementById ("Show"). Innerhtml= "Non-legal identity card number"; }}</script>

Based on the Online ID card calculation formula written by a verification ID number JS

The first step: multiply the 1th digit of the ID number with 7, multiply the 2nd digit of the ID number with 9, multiply the 3rd digit of the ID number with 10, multiply the 4th digit of the ID number with 5, multiply the 5th digit of the ID number with 8, and multiply the 6th digit of the ID number with 4 , multiply the 7th digit of the ID number with 2, multiply the 8th digit of the ID number with 1, multiply the 9th digit of the identity card number with 6, multiply the 10th digit of the identity card number with 3; multiply the 11th digits of the ID number with 7, and multiply the 12th digits of the ID number by 9 , multiply the 13th digit of the ID number with 10, multiply the 14th digit of the ID number with 5, multiply the 15th digit of the identity card number with 8, multiply the 16th digit of the ID number with 4, and multiply the 17th digit of the ID number with 2.

The second step: the first step ID number 1~17 phase multiply the result sum, all add up.

The third step: The result calculated by the second step is divided by 11, so that the remainder is 0, the remainder is 1, the remainder is 2, the remainder is 3, the remainder is 4, the remainder is 5, the remainder is 6, the remainder is 7, the remainder is 8, the remainder is 9, the remainder is 10 altogether 11 kinds of possibility.

Fourth step: If the remainder is 0, the corresponding last ID number is 1, if the remainder is 1, the corresponding last ID number is 0; if the remainder is 2, the number of the corresponding last ID is x; if the remainder is 3, the number of the last identity card corresponds to 9; If the remainder is 4, The number of the corresponding last identity card is 8; If the remainder is 5, the number of the corresponding last ID is 7, and if the remainder is 6, the number of the corresponding last ID is 6; If the remainder is 7, the number of the last identity card corresponds to 5; If the remainder is 8, The number of the corresponding last identity card is 4, if the remainder is 9, the number of the corresponding last ID is 3, and if the remainder is 10, then the number of the last identity card corresponds to 2.

JavaScript Authentication ID Number

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.