<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.title{
text-align: center;
color: blue;
}
.test1{
width:500px;
height:500px;
border:1px solid pink;
background-color: #eeeeee;
opacity:0.7;
filter:alpha(opacity=70);
text-align:center;
margin-top: 200px;
margin-left: 700px;
position: relative;
}
.enter{
text-align: center;
}
#lxy{
background-image: url("images/cx.jpg");
}
</style>
<script>
function validate() {
��
var uname=document.getElementById("uname").value;
var reg=new RegExp(/^\w{6,20}$/);
if(uname!=null&®.test(uname)){
//alert("用户名格式正确");
}else{
alert("用户名格式错误");
return false;
}
�
var pass=document.getElementById("paw").value;
var pass1=document.getElementById("paw1").value;
var reg1=new RegExp(/^[a-zA-Z0-9_-]{6,16}$/);
//alert(pass);
//alert(pass1);
if(pass!=null&®1.test(pass)&&pass==pass1){
//alert("密码输入正确");
}else{
alert("密码格式错误或密码不相同");
return false;
}
var em=document.getElementById("email").value;
var reg2=new RegExp(/^([\w\.-]+)@(\w+)\.(\w+)$/);
//alert(em);
if(reg2.test(em)){
//alert("邮箱输入正确")
}else{
alert("邮箱格式错误")
return false;
}
var number1=document.getElementById("siz").value;
var reg3=new RegExp(/^\d{15}$|^(\d{18}|\d{17}[xX])$/);
//alert(number1);
if(reg3.test(number1)){
//alert("身份证格式正确")
return true;
}else{
alert("身份证格式错误")
return false;
}
}
</script>
</head>
<body id="lxy">
<div class="test1">
<div class="title"><h2>***欢迎用户注册***</h2></div>
<form id="form1" onsubmit="return validate()" action="regnoservlet" method="post">
<p>用户名:   <input type="test" name="username" id="uname" placeholder="请输入用户名"/></p></br>
<p>密码:       <input type="password" name="password" id="paw" placeholder="请输入密码"/></p></br>
<p>确认密码:<input type="password" name="repassword" id="paw1" placeholder="请确认密码"/></p></br>
<p>邮箱:       <input type="email" name="email" id="email" placeholder="请输入邮箱"/></p></br>
<p>身份证号:<input type="test" id="idcard" name="idcard" placeholder="请输入身份证号"/></p></br>
<div class="cookiechk">
<label><input type="checkbox" name="CookieYN" id="CookieYN" value="1" />记住账号</label>
</div>
<div class="enter">
<input type="submit"/>
<input type="reset"></div>
</form>
</div>
</body>
</html>
网友评论