﻿// JScript 文件
function btnClick()   
{       
  if(event.keyCode==13)   
  {   
      event.keyCode=9; 
      event.returnValue = false;   
      document.all("btnSave").click();     
  }   
}  


function CheckNull(rName,tel,email,con,code,addr,company)
{
    if (rName.value=="")
    {
        alert("您的姓名不能为空！");
        rName.focus();
        return false;
    }
    else if (company.value=="")
    {
        alert("单位名称不能为空！");
        company.focus();
        return false;
    }
    else if (addr.value=="")
    {
        alert("单位地址不能为空！");
        addr.focus();
        return false;
    }
    else if (tel.value=="")
    {
        alert("联系电话不能为空！");
        tel.focus();
        return false;
    }
    else if (email.value=="")
    {
        alert("Email不能为空！");
        email.focus();
        return false;
    }
    else if(EmailCheck(email.value)==false) 
    {
      alert("无效的Email！");
      email.focus();
      return false;
    }
    else if (con.value=="")
    {
        alert("留言内容不能为空！");
        con.focus();
        return false;
    }
    else if (code.value=="")
    {
        alert("验证码不能为空！");
        code.focus();
        return false;
    }
    else
        return true;
}

function EmailCheck (obj) {
    var emailPat=/^(.+)@(.+)$/;
    var matchArray=obj.match(emailPat);
    if (matchArray==null) {
      return false;
    }
    return true;
}

