欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

根據(jù)身份證號自動輸出相關(guān)信息(籍貫,出身日期,性別)

 更新時間:2013年11月15日 11:47:16   投稿:mdxy-dxy  
為了減少客戶的在頁面的輸入,做了這個效果,他可以根據(jù)用戶輸入的身份證號輸出籍貫、出身日期、性別的相關(guān)信息,需要的朋友可以參考下

html代碼:

復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" src="base.js"></script>
<title>身份證相關(guān)</title>
</head>
<body>
身份證號碼:<input id="idcard" type="text" onkeyup="go()"></> </br>
管籍:<input id = "address" type="text" /></br>
出生年月:<input id='year' type="text" /></br>
性別:<input id='sex' type="text"/></br>
</body>
</html>


 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   
           }
        }
     }
[/code]

相關(guān)文章

最新評論