<script type="text/javascript">
function checkform(f){
var r = f.un, m = f.tel, a = f.msg;
if(!/^[\u4e00-\u9fa5]{2,4}\s*$/.test(r.value)){
alert('请输入正确的姓名!');
r.focus();
return false;
}else if(!/^(1[3,4,5,7,8]\d{9}|0\d{2,3}[\s\-]?\d{7,8}([\s\-]\d{1,4})?)\s*$/.test(m.value)){
alert('请输入正确的11位手机号或电话,电话要带区号!');
m.focus();
return false;
}else if(a.value.substr(0,20).replace(/\s/g,'').length<4){
alert('请输入问题!');
a.focus();
return false;
}
//f.submit();
tijiao();
return true;
}
function submit(callback){
document.getElementById("formq").submit();
callback();
}
function tijiao(){
submit(reset);
}
function reset(){
document.getElementById("formq").reset();
}
</script>
//////////////
<form style="margin:0;padding:0" method="post" action="xxx.php" target="_self" onsubmit="return checkform(this)" id="formq">
………………
</form>