<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="script/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="script/jquery-1.4.1.js" type="text/javascript"></script>
<script src="script/jquery.validate.min.js" type="text/javascript"></script>
<script src="script/jquery.validate.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$().ready(function () {
$("#commentForm").validate({
rules: {
firstname: "required",
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 5
},
confirm_password: {
required: true,
minlength: 5,
equalTo: "#password"
}
},
messages: {
firstname: "<font color='red'>请输入用户名</font>",
email: {
required: "请输入Email地址",
email: "请输入正确的email地址"
},
password: {
required: "请输入密码",
minlength: jQuery.format("密码不能小于{0}个字符")
},
confirm_password: {
required: "请输入确认密码",
minlength: "确认密码不能小于5个字符",
equalTo: "两次输入密码不一致不一致"
}
}
});
});
</script>
</head>
<body>
<form id="commentForm" method="get" action="">
<label for="firstname">Firstname</label>
<input id="firstname" name="firstname" />
<label for="email">E-Mail</label>
<input id="email" name="email" />
<label for="password">Password</label>
<input id="password" name="password" type="password" />
<label for="confirm_password">确认密码</label>
<input id="confirm_password" name="confirm_password" type="password" />
<input class="submit" type="submit" value="Submit"/>
</form>
</body>
</html>