身份证

if( obj && customerCertiType=="11"){
               if(!obj.match(/^\w{18}$/) && !obj.match(/^\w{15}$/)){
                   //obj.focus();
                if(window.alert("身份证号长度应为18位或15位!")){
                    
                    return ;
                }
               }else{
                   var year;
                   var month;
                   var date;
                   if(obj.length == 18){
                       if(identifyVerify(obj)){
                        year = obj.substring(6,10);
                        month = obj.substring(10,12);
                        date = obj.substring(12,14);
                        var sexMrk = obj.substring(16,17);
                           if(sexMrk % 2 == 0){
                                tool.setAttrValue(dwName,"gender","F");//mxt
                                   //issTool.setAttrValue(dw[prefix],prefix+".CSex",[2,'女']);    
                           }else{
                                tool.setAttrValue(dwName,"gender","M");//mxt
                                   //issTool.setAttrValue(dw[prefix],prefix+".CSex",[1,'男']);
                           }
                       }else{
                           alert("身份证号校验错误!");
                           //obj = "";
                        //obj.focus();
                        return ;
                       }
                   }
                   if(obj.length == 15){
                       year = obj.substring(6,8);
                       month = obj.substring(8,10);
                       date = obj.substring(10,12);
                       var toYear = String(new Date().getFullYear()).substring(2,4);
                       year = "19" + year;
                       var sexMrk = obj.substring(14,15);
                       if(sexMrk % 2 == 0){
                           tool.setAttrValue(dwName,"gender","F");//mxt
                               //issTool.setAttrValue(dw[prefix],prefix+".CSex",[2,'女']);
                       }else{
                           tool.setAttrValue(dwName,"gender","M");//mxt
                               //issTool.setAttrValue(dw[prefix],prefix+".CSex",[1,'男']);
                       }
                   }
                if(year < 1900 || year > new Date().getFullYear() || month > 12 || month < 1 || date > 31 || date < 1){
                    alert("出生日期:" + year + "年" + month + "月" + date + "日 不是合法日期,请检查");
                    //obj = "";
                    //obj.focus();
                    return ;
                }    
                var ageMrk = parseInt(new Date().getFullYear()) - parseInt(year);
               }
           }else{//非身份证
               
           }

 

posted @ 2015-09-16 13:55  也猫不要吃鱼  阅读(261)  评论(0编辑  收藏  举报