- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <title> New Document </title>
- <meta name="Generator" content="EditPlus">
- <meta name="Author" content="">
- <meta name="Keywords" content="">
- <meta name="Description" content="">
- <script src="http://code.jquery.com/jquery-latest.js"></script>
- <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js" type="text/javascript"></script>
- </head>
- <body>
- <SCRIPT type="text/javascript">
- $(document).ready(function(){
- $("#signupForm").validate({
- rules: {
- uname: "required",
- email: {
- required: true,
- email: true
- },
- pwd: {
- required: true,
- minlength: 5
- },
- conpwd:{
- required: true,
- minlength: 5,
- equalTo: "#pwd"
- }
- },
- messages: {
- uname: "请输入姓名",
- email: {
- required: "请输入Email地址",
- email: "请输入正确的email地址"
- },
- pwd: {
- required: "请输入密码",
- minlength: jQuery.format("密码不能小于{0}个字符")
- },
- conpwd: {
- required: "请输入确认密码",
- minlength: "确认密码不能小于5个字符",
- equalTo: "两次输入密码不一致不一致"
- }
- }
- });
- });
- </SCRIPT>
- <form id="signupForm" method="post" action="">
- <p>
- <label for="uname">
- 用户名:
- </label>
- <input id="uname" type="text" name="uname" />
- </p>
- <p>
- <span style="width: 18px;"></span>
- <label for="pwd">
- 密码:
- </label>
- <input type="password" id="pwd" name="pwd" />
- </p>
- <p>
- <label for="con-pwd">
- 确认密码:
- </label>
- <input type="password" id="conpwd" name="conpwd" />
- <span style="width: 20px"></span>
- </p>
- <p>
- <span style="width: 20px"></span>
- <label for="email">
- 邮箱:
- </label>
- <input type="text" id="email" name="email" />
- </p>
- <p>
- <input class="submit" type="submit" value="注册">
-
- <input type="reset" value="取消" />
- </p>
- </form>
- </body>
- </html>
Jquery中的验证
最新推荐文章于 2024-11-03 20:03:09 发布