<script type="text/javascript">
$(document).ready(function(){
$.formValidator.initConfig({autotip:true,onerror:function(msg){},onsuccess:function(){}});
$("#youxiang").formValidator({tipid:"tip_youxiang",onshow:"请输入您的邮箱",onfocus:"邮不能为空"}).inputValidator({min:6,max:100,onerror:"你输入的邮箱长度非法,请确认"}).regexValidator({regexp:"^([//w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([//w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$",onerror:"你输入的邮箱格式不正确"});
$.formValidator.initConfig({validatorgroup:"2",autotip:true,onerror:function(msg){},onsuccess:function(){}});
$("#zsname").formValidator({validatorgroup:"2",tipid:"tip_zsname",onshow:"请输入标题",onfocus:"请输入4-30个字符"}).inputValidator({min:4,max:100,onerror:"长度不符合要求,请输入6-30个字符"}).functionValidator({ fun: function(val, elem) { var reg=/^[+-]?/d+(/./d+)?$/; return !reg.test(val.replace(/(^/s*)|(/s*$)/g, "")); }, onerror: "标题不能为纯数字" });
$("#numbertxt").formValidator({validatorgroup:"2",tipid:"tip_numbertxt",onshow:"请输入身份证号",onfocus:"身份证号不能为空的哦"}).inputValidator({ onerror: "请正确输入身份证号码" }).functionValidator({ fun: function(val, elem) {
elem.value = $.h.pub.trimall(elem.value);
return true;
}
}).regexValidator({ regexp: "^[0-90-9]{14}[0-90-9xX]$|^[0-90-9]{17}[0-90-9xX]$", onerror: "请正确输入身份证号码" });
});
rez = function(fid,p,m){
switch(fid)
{
case "1":$("#Hidden1").val("emck");return jQuery.formValidator.pageIsValid("1");break;
case "2":$("#Hidden1").val("truename");return jQuery.formValidator.pageIsValid("2");break;
default:$("#Hidden1").val("license");return jQuery.formValidator.pageIsValid("3");
}
}
</script>
<input id="smsubmit" name="smsubmit" type="submit" value="提交验证" οnclick="return rez('2','emck','')" class="btn" />
需要注意的地方:显示声明分组,注意区分大小写