最近做表单验证,发现Validform这款插件很好用,官网地址http://validform.rjboy.cn/document.html
自己按照它的文档介绍很快写了一个简单的例子,
- <script type="text/javascript" src="http://validform.rjboy.cn/wp-content/themes/validform/js/jquery-1.6.2.min.js"></script>
- <script type="text/javascript" src="http://validform.rjboy.cn/Validform/v5.1/Validform_v5.1_min.js"></script>
- <script>
- $(function(){
- // $(".registForm").Validform(); //就这一行代码!;
- $(".registForm").Validform({tiptype:2});
- });
- </script>
- <form class="registForm" action="regist.action" method="post" enctype="multipart/form-data">
- <table border="0px" align="center" height="480px" style="color:#666666">
- <tr><td colspan="3" align="center" style="font-size:16px;color:#F07F00">请输入注册信息</td></tr>
- <tr>
- <td align="left">注册邮箱:</td>
- <td><input class="inputxt" type="text" id="account" name="account" datatype="e"
- nullmsg="请输入注册邮箱!" errormsg="不是合法的邮箱!" /></td>
- <td><div id="accountValidate" class="Validform_checktip"></div></td></tr>
- <tr>
- <td align="left">创建密码:</td>
- <td><input class="inputxt" type="password" name="password" datatype="*6-15" nullmsg="请输入密码!" errormsg="密码范围在6~15位之间!" /></td>
- <td><div class="Validform_checktip"></div></td></tr>
- <tr>
- <td align="left">确认密码:</td>
- <td><input class="inputxt" type="password" name="password2" datatype="*6-15" recheck="password" nullmsg="请确认密码!" errormsg="2次密码不一致!" /></td>
- <td><div class="Validform_checktip"></div></td></tr>
- <tr>
- <td></td>
- <td align="left"><input type="submit" id="submit_btn" value="" class="regist_but"/></td>
- </tr>
- </table>
- </form>