jQuery formValidator表单验证插件3.5a ,适合jQuery1.3.2类库
使用插件必须加载的文件
//加载jQuery类库<script src="jquery_last.js" type="text/javascript"></script>//加载插件的样式库,如果你是自动构建提示层,请加载validatorAuto.css<link type="text/css" rel="stylesheet" href="style/validator.css"></link>//加载插件 <script src="formValidator.js" type="text/javascript"></script>//加载扩展库<script src="formValidatorRegex.js" type="text/javascript"></script>
---------------------------------------------------------------------------------
<script src="jquery_last.js" type="text/javascript"></script><link type="text/css" rel="stylesheet" href="style/validator.css"></link><script src="formValidator.js" type="text/javascript"></script><script src="formValidatorRegex.js" type="text/javascript"></script><script type="text/javascript">$(document).ready(function()//必须加下面这一句,否则会出现'tidymode' 为空或不是对象 错误 $.formValidator.initConfig({formid:"form1",onerror:function(msg){},onsuccess:function(){return true;}}); $("#name").formValidator({onshow:"请输入用户名"}).regexValidator({regexp:"username",datatype:"enum",onerror:"用户名格式不正确"})});</script>-----------------------------------------------------------------------
表单代码:
<form action="result.php" method="post" name="form1" id="form1"> <tr> <td width="30%" align="right" bgcolor="#F2F2F2">姓名:</td> <td width="261"><input name="studentName" type="text" size="15" id="name"/></td> <td><div id="nameTip" style="width:250px"></div></td> </tr>