4、//擴展validator的校驗方法$.validator.addMethod(/zonlyLetterAndDigit",function(value,element,params){varrcgcx=newRegExp(J[0-9a-zA-Z]+$,);returnregex,test(value);},〃只能輸入字母或數(shù)字〃);$(function(){$(〃#rcgistc")?validate({//定義驗證規(guī)則,其屮屈性名為表單的name屈性rules:{username:{required:true,
5、onlyLetterAndDigit:true,//使用自定義方法限制只能輸入字母或數(shù)字rangelength:[4,20],remote:/zregiste!validName.action"http://使用町AX異步校驗},password:{required:true,rangelength:[4,20]},chkpassword:{required:true,cqualTo:/z#passwordz/},emai1:{required:true,emai1:true},vercode:,,required,/},m
6、essages:{username:{rcquired:〃請輸入用戶名",rangelength:,z用戶名長度必須在4?20位Z間",remote:$.format(,z用戶名{0}已存在,請重新輸入!“)},password:{required:請輸入密碼",rangelength:密碼長度必須在4?20位Z間〃},chkpassword:{required:z,請再次輸入密碼〃,cqualTo:,z密碼輸入不一致,請重新輸入〃},emai1:{required/7請輸入電子郵件〃,email:〃請輸入合法的電
7、子郵件〃},vercode:{required:〃請輸入驗證碼"});});//刷新驗證碼functionrefresh(){$(,,#authlmg,/).src=/,authlmg?now二〃+newDate();}//-->