gbook.js

来自「前台完全分离了HTML与ASP」· JavaScript 代码 · 共 73 行

JS
73
字号
function isNum(str)
  {
    for(i=0;i<str.length;i++)
    {
     if(str.charAt(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.RefuseAD.checked)
	{
		alert("对不起.为了防止一些广告软件投放广告,请勾上<非广告>的复选框");
		return false;
	}
	return true;
	 
 }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?