12){ alert("姓名长度不能超过12个汉字!"); name.focus(); return false; } //验证昵称 if(nicheng.value==""){ alert("请输入昵称!"); name.focus(); return false; }else if(name.value.length>12){ alert("昵称长度不能超过12个汉字!"); name.focus(); return false; } //验证电话格式 var tel_ = tel.value.trim(); if(tel_=="") { alert("请输入手机"); tel.focus(); return false; } if(tel_!="") { var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|170|176|177)+\d{8})$/; if(!myreg.test(tel_)) { alert("请输入有效的手机号码"); tel.focus(); return false; } } //验证email格式 if(email.value==""){ alert("请输入Email地址!"); email.focus(); return false; }else if((email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)){ alert("请输入正确的Email地址"); email.focus(); return false; } //校验验证码 var yzm = document.getElementById("yzm"); if(yzm.value==""){ alert("请输入验证码!"); yzm.focus(); return false; } else if(yzm.value.search("^-?\\d+(\\.\\d+)?$")!=0){ alert("验证码请输入数字!"); yzm.focus(); return false; } var c=content.value; b=c.replace(/(^\s*)|(\s*$)/g,""); if (b==""){ alert("请输入内容!"); content.focus(); return false; } if(c.length>400){ alert("内容长度过长,最多200个汉字!"); content.focus(); return false; } for(var i=0;i<=regArray.length;i++){ if(content.value.toLowerCase().indexOf(regArray[i]) != -1){ alert("您输入的内容中含有非法字符或脚本语言,请检查后重新输入!"); content.focus(); return false; } } return true; }