<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
<script type="text/javascript" src="jslib/jquery-1.3.2.js"></script>
<link href="jslib/jquery.validate.css" type="text/css" rel="stylesheet" />
<script src="jslib/jquery.validate.js" type="text/javascript"></script>
<script src="jslib/messages_cn.js" type="text/javascript"></script>
</head>
<body>
<form id="inputForm" action="" method="post">
用户名:
<input class="input" id="memberName" name="memberName" type="text" />
<ul>
<li>
由字母a~z,A~Z(不区分大小写)开头
</li>
<li>
包含字母、数字0~9、下划线,例如:beijing2008
</li>
<li>
用户名长度为4~18个字符
</li>
</ul>
密码:
<input class="input" id="memberPW" name="memberPW" type="text" />
密码长度6~16位,只能输入英文字母,数字或符号写
<br>
确认密码:
<input class="input" name="passwordConfirm" type="text" />
<br>
电子邮箱:
<input class="input" name="email" type="text" />
<br>
<input type="submit" value="注册" />
</form>
<script>
$(document).ready(function(){
//聚焦第一个输入框
$("#memberName").focus();
var times=new Date().getTime();
//为inputForm注册validate函数
$("#inputForm").validate({
rules: {
memberName: {
required: true,
minlength:4,
maxlength:18,
remote:"远程验证url"
},
memberPW: {
required: true,
minlength:6,
maxlength:16
},
pic:{
required: true,
minlength:4,
maxlength:4,
remote:"远程验证url"
},
passwordConfirm: {
equalTo:"#memberPW"
},
email:{
email:true,
required: true
}
},
messages: {
memberName: {
required:"用户名必填",
minlength:"用户名最少4位",
maxlength:"用户名最多18位",
remote:"用户名已存在"
},passwordConfirm: {
equalTo: "重复密码不对"
},pic: {
required:"验证码必填",
minlength:"请输入4 位验证码",
maxlength:"请输入4 位验证码",
remote:"验证码错误"
},
memberPW:{
required:"密码必填",
minlength:"密码最少6位",
maxlength:"密码最多16位"
},
email:{
required:"邮箱必填"
}
}
});
});
</script>
</body>
</html>