| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title></title> | |
| </head> | |
| <script type="text/javascript" src="../js/jquery-1.11.0.js" ></script> | |
| <script type="text/javascript" src="../js/jquery.validate.js" ></script> | |
| <script type="text/javascript" src="../js/messages_zh.js" ></script> | |
| <script> | |
| $(function(){ | |
| $("#formid").validate({ | |
| rules:{ | |
| username:"required", | |
| password:{ | |
| rangelength:[3,6], | |
| required:true | |
| }, | |
| repassword:{ | |
| equalTo:"#password" | |
| }, | |
| email:"email", | |
| sex:"required" | |
| }, | |
| messages:{ | |
| username:"用户名不能为空", | |
| password:{ | |
| rangelength:"密码长度在{0}~{1}之间", | |
| required:"密码不能为空" | |
| } | |
| } | |
| }); | |
| }) | |
| </script> | |
| <style> | |
| </style> | |
| <body> | |
| <form action="#" method="get" id="formid"> | |
| <table width="60%" height="60%" align="center" bgcolor="#ffffff"> | |
| <tr> | |
| <td colspan="3">会员注册USER REGISTER</td> | |
| </tr> | |
| <tr> | |
| <td width="20%">用户名:</td> | |
| <td width="80%"><input type="text" name="username" id="username"></td> | |
| </tr> | |
| <tr> | |
| <td>密码:</td> | |
| <td><input type="password" name="password" id="password"></td> | |
| </tr> | |
| <tr> | |
| <td>确认密码:</td> | |
| <td><input type="password" name="repassword" id="repassword"></td> | |
| </tr> | |
| <tr> | |
| <td>Email:</td> | |
| <td><input type="text" name="email" id="email"></td> | |
| </tr> | |
| <tr> | |
| <td>姓名:</td> | |
| <td><input type="text" name="name"></td> | |
| </tr> | |
| <tr> | |
| <td>性别:</td> | |
| <td> | |
| <input type="radio" name="sex" value="男" checked="checked"> 男 | |
| <input type="radio" name="sex" value="女" />女 | |
| <!--<label for="sex" class="error"></label>--> | |
| <label for="sex" class="error"></label> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td>出生日期</td> | |
| <td> | |
| <input type="text" name="birthday"> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td>验证码</td> | |
| <td> | |
| <input type="text" name="checkcode"> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td colspan="2"> | |
| <input type="submit" value="注册" /> | |
| </td> | |
| </tr> | |
| </table> | |
| </form> | |
| </body> | |
| </html> |
原文:http://www.cnblogs.com/nextgg/p/7646735.html