if (document.form1.csrq.value== "") {
Alert ("Please fill in the date of birth!");
Document.form1.csrq.focus ();
return false;
}
if (document.form1.csrq.value== "") {
Alert ("Please fill in the date of birth!");
Document.form1.csrq.focus ();
return false;
}else{
if (document.form1.csrq.value.length!=8) {
Alert ("Date of birth must be 8 digits!") ");
Document.form1.csrq.focus ();
return false;
}
if (document.form1.sfzh.value.length==18) {
var Sfzh =document.form1.sfzh.value;
if (document.form1.csrq.value!=sfzh.substring (6,14)) {
Alert ("Date of birth is inconsistent with the identity card number!") ");
Document.form1.csrq.focus ();
return false;
}
}
if (document.form1.sfzh.value.length==15) {
var Sfzh =document.form1.sfzh.value;
if (document.form1.csrq.value!= ' +sfzh.substring (6,12)) {
Alert ("Date of birth is inconsistent with the identity card number!") ");
Document.form1.csrq.focus ();
return false;
}
}
}
if (!isidcardno (Document.form1.sfzh.value)) {
Document.form1.sfzh.focus ();
return false;
}
function Isnn (num) {
var Badchar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Capital
Badchar + = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; lowercase letters
Badchar + = "0123456789"; Digital
Badchar + = "" + "";//Half-width and full-width spaces
Badchar + = "' ~!@#$%^& ()-_=+]\\|:;\" \ "<,>?/";//Special symbol
var C;
for (Var i=0;i<name.length;i++) {//To determine the characters in name in turn
C=num.charat (0);//Remove the 1th character in num
if (Badchar.indexof (c)!=-1) {//If the current character finds a matching character in the Badchar, it is not a Chinese character
return false;
} else{
return true;
}
}
function Isidcardno (num)
{
if (isNaN (num)) {alert ("input is not a number!") "); return false;}
var len = num.length, re;
if (len = = 15) {
Re = new RegExp (/^ (\d{6}) ()? ( \D{2}) (\d{2}) (\d{2}) (\d{3}) $/);
}else if (len = = 18) {
Re = new RegExp (/^ (\d{6}) ()? ( \D{4}) (\d{2}) (\d{2}) (\d{3}) (\d) $/);
}else if (ISNN (num)) {
return true;
}else {
Alert ("If the officer number is entered in full, for example: An Officer ID number is the 123,456th number;" If it is an ID number, please check that you entered a number of digits, must be 15-bit or 18-bit. ");
return false;
}
var a = Num.match (re);
if (a!= null)
{
if (len==15)
{
var D = new Date ("+a[3]+"/"+a[4]+"/"+a[5]");
var B = D.getyear () ==a[3]&& (D.getmonth () +1) ==a[4]&&d.getdate () ==a[5];
}
if (len = = 18)
{
var D = new Date (a[3]+ "/" +a[4]+ "/" +a[5]);
var B = D.getfullyear () ==a[3]&& (D.getmonth () +1) ==a[4]&&d.getdate () ==a[5];
}
if (! B) {alert ("Enter the ID number" + a[0] + "in the wrong birth date!" "); return false;}
}
return true;
}
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.