ID check and get birthday code
Copy Code code as follows:
<script language= "JavaScript" >
Function Showbirthday (val)
{
var Birthdayvalue;
if (15==val.length)
{///15-digit ID number
Birthdayvalue = Val.charat (6) +val.charat (7);
if (parseint (birthdayvalue) <10)
{
Birthdayvalue = ' +birthdayvalue ';
}
Else
{
Birthdayvalue = ' +birthdayvalue ';
}
Birthdayvalue=birthdayvalue+ '-' +val.charat (8) +val.charat (9) + '-' +val.charat (a) +val.charat (11);
if (parseint (Val.charat)/2 *2!=val.charat (14))
document.all.sex.value= ' Male ';
Else
document.all.sex.value= ' female ';
Document.all.birthday.value=birthdayvalue;
}
if (18==val.length)
{///18-digit ID number
Birthdayvalue=val.charat (6) +val.charat (7) +val.charat (8) +val.charat (9) + '-' +val.charat (Ten) +val.charat (11) + '-' + Val.charat (a) +val.charat (13);
if (parseint (Val.charat)/2 *2!=val.charat (16))
document.all.sex.value= ' Male ';
Else
document.all.sex.value= ' female ';
if (Val.charat ()!=idcard (Val))
{
Document.all.idcard.style.backgroundcolor= ' #ffc8c8 ';
}
Else
{
document.all.idcard.style.backgroundcolor= ' White ';
}
Document.all.birthday.value=birthdayvalue;
}
}