1、身份验证

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<style type="text/css">
#apDiv1 {
    position: absolute;
    left: -19px;
    top: 42px;
    background-color: #0F6;
    width: 1024px;
    height: 980px;
    z-index: 1;
}
#apDiv2 {
    position: absolute;
    left: 4px;
    top: 45px;
    background-color: #69F;
    width: 977px;
    height: 99px;
    z-index: 2;
}
#apDiv3 {
    position: absolute;
    left: 4px;
    top: 141px;
    width: 102px;
    height: 868px;
    z-index: 3;
}
</style>
</head>

<body>
 <div id="apDiv1"></div>
 <div id="apDiv2">
 <p align="center"><font size="+4">导航栏</font></p>
 </div>
 <div id="apDiv3"></div>
 请输入你的身份证号:<input type="text" id="id"/>
 <div><br />
  <input type="button" value="提交" onclick="check()"/>
 </div>
</body>
</html>
<script >
function check()
{
var  reg= new RegExp(/^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/);

var id=document.getElementById("id").value;
if(reg.test(id)){

          alert("输入正确") 
         }

    else{
        alert("输入错误");

      }    
    } 
 
</script>
</body>
</html>

 

posted on 2016-02-26 08:40  悠悠小花  阅读(187)  评论(0编辑  收藏  举报