Home > Web Front-end > JS Tutorial > Specific implementation of the complete method of verifying ID cards in javascript_javascript skills

Specific implementation of the complete method of verifying ID cards in javascript_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:14:22
Original
1120 people have browsed it

Copy code The code is as follows:

var certCardValid = function(id){
      var arrVerifyCode = [1,0,"x",9,8,7,6,5,4,3,2];
var wi = [7,9,10,5,8,4,2,1 ,6,3,7,9,10,5,8,4,2];
var Checker = [1,9,8,7,6,5,4,3,2,1,1];
var msg = "";
if(id.length != 15 && id.length != 18) {
var msg = ""; Or 18 bits. ");
                                                                                    ; "19" id.slice(6,16);


if (!/^/d $/.test(ai)) {
Ext.MessageBox.alert("Message prompt" ,"Except for the last digit, the ID card must be a number.");
              return false; > var mm = ai.slice(10,12)-1;
var dd = ai.slice(12,14);
var d = new Date(yyyy,mm,dd);
var now = new Date();
var year = d.getFullYear();
var mon = d.getMonth();
var day = d.getDate();


          if (year != yyyy || mon != mm || day != dd) {
                Ext.MessageBox.alert("Message prompt", "The ID card is invalid. ");
                                                ; i) * wi[i];
}

ai = arrVerifyCode[ret %= 11];
ai = ai.toUpperCase();


if( id.length == 18 && id != ai){
             Ext.MessageBox.alert("Message prompt", "The ID card is invalid."); ;
};


Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template