赞
踩
【实例简介】 身份证信息查询例子
【实例截图】
【核心代码】
function go(){
var dataNum = mySite.cityData.length;
var id = document.getElementById("idcard").value;//612527197004235911
var last = id[id.length-2];
if(last %2 != "0"){
document.getElementById("sex").value = '男'
}else{
document.getElementById("sex").value = '女'
}
if(id.length==15){
var year = "19" id.substring(6,8) "-" id.substring(8,10) "-" id.substring(10,12);
document.getElementById("year").value = year;
}
if(id.length==18){
var year = id.substring(6,10) "-" id.substring(10,12) "-" id.substring(12,14);
document.getElementById("year").value = year;
}
for (var i = 0; i < dataNum; i ) {
if(id.substring(0,6)==mySite.cityData[i].code){
document.getElementById("address").value = mySite.cityData[i].title
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。