<!--检查客户留言是否输入正常-->
//检验EMAIL是否合法
function checkMail(s)
{
  var pattern=/\w+@\w+\.[a-z]+/;
  if(pattern.test(s))
{
   return true;
  }
    else
 {
   return false;
  }
}
//检验电话号码是否合法
function checkNumber(ch)
{
if (ch>='0' && ch<='9')
{
//alert("合法");
return true;
}
else
{
// alert("不合法");
return false;
}
}
<!--检查留言是否输入正常-->
<!--
function isEmpty(s)  //检查是否为空
{  
  return ((s == null) || (s.length == 0))
}

function isWhitespace (s)  //检查是否有空格
{  
  var whitespace = " \t\n\r";
  var i;
  for (i = 0; i < s.length; i++)
  {   
    var c = s.charAt(i);
    if (whitespace.indexOf(c) >= 0) 
    {
      return true;
    }
  }
  return false;
}

function isCharsInBag (s, bag)
{  
  var i;
  for (i = 0; i < s.length; i++)
  {   
    var c = s.charAt(i);
    if (bag.indexOf(c) == -1) return false;
    }
  return true;
}


function isEmail (s)  //判断是否是正确的EMAIL格式
{
  if (isEmpty(s))
  {
    window.alert("E-mail address entered can not be empty, enter the");	
    return false;
  }
  if (isWhitespace(s))
  {
    window.alert("Enter the E-mail address can not contain spaces, please re-enter");	
    return false;
  }
  var i = 1;
  var len = s.length;

  if (len > 50)
  {
    window.alert("email address can not be longer than 50");
    return false;
  }
	
  pos1 = s.indexOf("@");
  pos2 = s.indexOf(".");
  pos3 = s.lastIndexOf("@");
  pos4 = s.lastIndexOf(".");
  if ((pos1 <= 0)||(pos1 == len)||(pos2 <= 0)||(pos2 == len))  
  {
    window.alert("Please enter a valid E-mail Address");
    return false;
  }
  else
  {
    if( (pos1 == pos2 - 1) || (pos1 == pos2 + 1) || ( pos1 != pos3 )|| ( pos4 < pos3 ) ) 		
      {
        window.alert("Please enter a valid E-mail Address");
        return false;
      }
  }

  if ( !isCharsInBag( s, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@"))
  {
    window.alert("email地址中只能包含字符ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@\n" + "请重新输入" );
    return false;
  }
  return true;
}
//-->


<!--检查留言是否输入正常-->
function CheckGuestBookSave()
{ 
 if (document.Book.Somane.value=="")
   { alert("Please enter the contact name")
	 document.Book.Somane.focus();
	 return false;
   }
  if (document.Book.address.value=="")
   { alert("Please enter mailing address")
	 document.Book.address.focus();
	 return false;
   }
  if (!isEmail(document.Book.Email.value))
  {
    this.Book.Email.focus();
    return false
  }
  if (document.Book.Phone.value=="")
   { alert("Please enter your contact Phone")
	 document.Book.Phone.focus();
	 return false;
   }
 for(i=0;i<document.Book.Phone.value.length;i++)
	{
	 ch=document.Book.Phone.value.charAt(i)
	if(!checkNumber(ch))
	{
	alert("Enter your contact phone number is not correct, check for errors.");
	document.Book.Phone.focus();
	return false;
	}
	}
	if (document.Book.Phone.value.length<8)
   { alert("You enter less than eight or more, please re-enter!")
	 document.Book.Phone.focus();
	 return false;
   }
  if (document.Book.Title.value=="")
   { alert("Please enter a topic name")
	 document.Book.Title.focus();
	 return false;
   }
  if (document.Book.Content.value=="")
   { alert("Please enter your feedback content")
	 document.Book.Content.focus();
	 return false;
   }
}



<!--检查客户输入搜索是否正确-->
function CheckSearch()
{  
 if (document.Search.Title.value=="")
   { alert("Please enter the name you want to search")
	 document.Search.Title.focus();
	 return false;
   }
}
