function isnum(str) { for(i=0;i="0" && str.charat(i)<="9") { } else { return 0; } } return 1; } function checkgbookform() { if (document.form1.name.value=="") { alert("不会是无名氏吧^_^~,还是请高提贵笔写一下吧。"); document.form1.name.focus(); return false; } if (document.form1.name.value.length>20) { alert("不会吧名字这么长啊~当前字数:"+document.form1.content.value.length) document.form1.name.focus(); return false; } if (document.form1.qq.value!="" && !(isnum(document.form1.qq.value))) { alert("qq必须是数字."); document.form1.qq.focus(); document.form1.qq.select(); return false; } if (document.form1.qq.value.length>10) { alert("腾讯好像现在也就10位数qq吧..") document.form1.qq.focus(); return false; } if (document.form1.mail.value.length>30) { alert("邮件地址太长了吧..") document.form1.mail.focus(); return false; } if (document.form1.home.value.length>200) { alert("主页地址太长了吧.别打广告进来啊...") document.form1.home.focus(); return false; } if (document.form1.content.value=="") { alert("不是吧,内容都不写,那我们怎么知道你想说什么呢?") document.form1.content.focus(); return false; } if (document.form1.content.value.length>1000) { alert("字数过多了.最大允许字数为1000个.请言简意赅些~当前字数:"+document.form1.content.value.length) document.form1.content.focus(); return false; } if (document.form1.rndnum.value=="") { alert("对不起,验证码必须正确填写"); document.form1.rndnum.focus(); return false; } return true; } function textcounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else countfield.value = maxlimit - field.value.length; }