<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>set your title</title>
<script type="text/javascript" src="../jquery-1.4.3.js"></script>
<link type="text/css" rel="Stylesheet" href="jquery.validity.css" />
<script type="text/javascript" src="jquery.validity.js"></script>
<script type="text/javascript">
$(function() {
$("#testform").validity(function() {
$("#username")
.require("用户名不能为空")
.match(/^\w+$/, "必须是数字或者字母")
.maxLength(12, "长度必须<=12")//不支持长度必须小于#{max}
.minLength(6, "长度必须>=6");//不支持长度必须大于#{min}
$("#password2")
.require("确认密码不能为空")
.match(/^\w+$/, "必须是数字或者字母")
.equal(function(val) {
return $("#password").val();
},"密码不匹配");
$("#birthday")
.require("生日不能为空")
.match("date");
.lessThanOrEqualTo(new Date())
});
});
</script>
</head>
<body>
<p><a href="./">上一级</a> </p>
<hr/>
<input type="button" name="btnTest" id="btnTest" value="点击测试" />
<hr/>
<div id="content">
<form action="" method="get" id="testform">
<p>
用户名:
<input type="text" name="username" id="username" />
</p>
<p>
密码:
<input type="text" name="password" id="password" />
</p>
<p>密码确认:
<input type="text" name="password2" id="password2" />
</p>
<p>生日:
<input type="text" name="birthday" id="birthday" />
(mm/dd/yyyy) </p>
<p>邮箱:
<input type="text" name="email" id="email" />
</p>
<p>QQ:
<input type="text" name="qq" id="qq" />
</p>
<p>
<input type="submit" name="button" id="button" value="提交" />
</p>
</form>
</div>
</body>
</html>
http://validity.thatscaptaintoyou.com
密码和密码确认不知道如何校验它们是否相等,因此抛弃这个检验框架,大喜大悲
如果有路过的高手,请指点.