<script type="text/javascript">
function chkform() {
var n = 0;
n += validator('#RealName', '#RealNamev', '请输入中文', /[\u4e00-\u9fa5]/);
n += validator("input[name='Sex']:checked", '#Sexv', '请选择性别', /[0,1]{1}/);
n += validator("#Province", '#Provincev', '请选择', /./);
n += validator("#Cityx", '#Cityxv', '请选择', /./);
n += validator("#Birthday", '#Birthdayv', '格式错误,格式参考:1984-03-19',/^(\d{4})-(\d{2})-(\d{2})$/);
n += validator("#IDNumber", '#IDNumberv', '请输入15位或者18位身份证号码!',/^\d{15}|\d{18}$/);
n += validator("#Address", '#Addressv', '!',/./);
n += validator("#ZipCode", '#ZipCodev', '请输入正确的邮政编码!',/^[1-9]\d{5}(?!\d)$/);
n += validator("#EduBackground", '#EduBackgroundv', '请选择', /./);
n += validator("#Telephone", '#Telephonev', '请输入正确的手机号码', /^0*(13|15)\d{9}$/);
n += validator("#Email", '#Emailv', '请输入正确Email地址', /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/);
n += validator("#StudyType", '#StudyTypev', '请选择', /./);
n += validator("#StudySubject", '#StudySubjectv', '请选择', /./);
//alert(n);
}
function validator(ojbName,validation,text,zz){
var objvalue = $(ojbName).val();
//alert(ojbName+":"+objvalue);
if(objvalue==null||objvalue==""||objvalue=="undefined"){
$(validation).html("此项目必填");
return 1;
}
else if (!zz.exec(objvalue)) {
$(validation).html(text);
return 1;
}else{
$(validation).html('');
return 0;
}
}
</script>