소스 검색

自动填充出生年月

LiFei 4 년 전
부모
커밋
f83d858d55
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      happy-job-base-system/src/main/webapp/webpage/modules/sys/hpuser/authform.jsp

+ 10 - 1
happy-job-base-system/src/main/webapp/webpage/modules/sys/hpuser/authform.jsp

@@ -256,6 +256,15 @@
                 }
             }
         }
+
+        function getBirthYear(){
+            if($("#idCardNumber").val().length==18){
+                $("#birthYear").val($("#idCardNumber").val().substring(6,10))
+			}else if($("#idCardNumber").val().length==15){
+                $("#birthYear").val($("#idCardNumber").val().substr(6,4))
+			}
+        }
+
 	</script>
 </head>
 
@@ -273,7 +282,7 @@
 			<div class="form-group col-sm-12">
 					<label class="col-sm-3 control-label"><font color="red">*</font>身份证号:</label>
 					<div class="col-sm-5">
-						<form:input path="idCardNumber" htmlEscape="false" maxlength="30" class="form-control input-sm required"/>
+						<form:input path="idCardNumber" htmlEscape="false" maxlength="30" onblur="getBirthYear()" class="form-control input-sm required"/>
 					</div>
 			</div>
 			<div class="form-group col-sm-12">