最近做表單驗證,發現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>