//ajax验证完成后的处理函数 function processValidateEmail(data) { if(data.message == "0")//表示服务器端没有该邮箱地址 { $('#your_email_img').html(""); $('#your_email_error').html(""); } else { $('#your_email_img').html(""); $('#your_email_error').html("This e-mail address has been used, please try another one.").attr("style","color:red;"); } } //客户端验证函数 function requireField(o) { var your_email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; var your_name = /^[a-zA-Z0-9_\-]{6,20}$/; var your_tel = /^(.){6,20}$/; var ks_birthday = /^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})+$/; var your_dateformat = /^([0-9]{4})[-]{1}([0-9]{2})[-]{1}([0-9]{2})$/; var your_password=/^(.){6,20}$/; var your_kong=/^(.){1,40}$/; var your_questioin=/^(\w){1,}|[^u4e00-u9fa5]{1,}$/; var your_answer=/^(\w){1,}|[^u4e00-u9fa5]{1,}$/; var your_birthday=/^(\w){1,}$/; var your_country=/^(\w){1,}|[^u4e00-u9fa5]{1,}$/; var your_muyu=/^(\w){1,}|[^u4e00-u9fa5]{1,}$/; var your_studyyear=/^(\w){1,}$/; var your_mudi=/^(.){1,128}$/; var your_qudao=/^(\w){1,}|[^u4e00-u9fa5]{1,}$/; var your_study_year=/^[1-9]\d*$/; var your_password2=$('#your_password').attr('value'); var checkcode=/^\d{3,4}$/; var your_zhunkz=/^(\w){1,40}$/; var your_zname=/^[^u4e00-u9fa5]{1,40}$/; var your_enname=/^(\w){1,}|[^u4e00-u9fa5]{1,}$/; var your_adress=/^(\w){1,}|[^u4e00-u9fa5]{1,}$/; var your_kaodian=/^(\w){1,}|[^u4e00-u9fa5]{1,}$/; var your_zhengjian=/^(.){3,38}$/; var your_oldpassword=/^(.){6,20}$/; var your_ucountry=/^(^\d){0,1}$/; var your_umuyu=/^(^\d){0,1}$/; var zhjtype2=/^[a-zA-Z0-9\u4E00-\u9FA5\uF900-\uFA2D]{2,}$/; var your_kong_error="Can not be empty!"; var your_email_error = "Please enter normal Email format!"; var your_name_error = "Please enter your name! 6-20 characters!"; var your_tel_error = "Please enter telephone number with 6-20 digits!"; var ks_birthday_error ="Birthday format error!"; var your_dateformat_error ="date format error!"; var your_password_error ="The password length is 6-20 characters!"; var your_kong_error ="Can not be empty!"; var your_questioin_error ="Can not be empty!"; var your_answer_error ="Can not be empty!"; var your_kong_error ="Can not be empty!"; var your_birthday_error ="Can not be empty!"; var your_country_error ="Can not be empty!"; var your_muyu_error ="Can not be empty!"; var your_studyyear_error ="Can not be empty!"; var your_mudi_error ="Can not be empty!"; var your_qudao_error ="Can not be empty!"; var your_study_year_error="Please enter integer value."; var your_password2_error="Two different passwords entered!"; var checkcode_error="Please enter validation code!"; var your_zhunkz_error="Please enter test admission ticket number!"; var your_zname_error="中文名2-10汉字!"; var your_enname_error="please enter name of ID Card."; var your_adress_error="Can not be empty!"; var your_kaodian_error="Can not be empty!"; var your_zhengjian_error="Select your valid certificate with a number of 3-38 characters."; var your_oldpassword_error="The password length is 6-20 characters!"; var your_ucountry_error="Please select nationality!"; var your_umuyu_error="Please select mother tongue!"; var zhjtype2_error="Certificate type with more than 3 digits!"; if(o.value.match(eval(o.id))) { return true; } else { $('#'+o.id+'_img').html(""); $('#'+o.id+'_error').html(eval(o.id+'_error')).attr("style","color:red;"); $('#'+o.id+'_imga').html(""); } return false; } //submit前的验证函数 function validate() { var biaozhi = true; $("input[needValidate='true']").each(function(i){ if(!requireField(this)) { biaozhi = false; } } ) return biaozhi; } function validateone(idname) { var biaozhi = true; if(!requireField(idname)) { biaozhi = false; } return biaozhi; }