Bangnie--website construction, website maintenance service provider.

News

funtion check() 里面的字段名称务必大小写一致。

Author:Website construction      AddDate:2020/1/4      From:Bangnie      Hits:22418

在把留言发送到特定邮箱的过程中,在提交之前进行验证表单的时候,funtion check()   check里面的字段名称有大小写区分,一定必须跟表单中的字段大小写保持一致,否则无法验证成功。只要有一个字母大小写不对,就出问题。
切记切记!!!经验啊经验!!!!!

标准实例如下:

<script language="JavaScript" type="text/JavaScript">
<!--
function check2(){
txtUserName=document.lianxi.txtUserName.value;
txtUserTel=document.lianxi.txtUserTel.value;
txtUserEmail=document.lianxi.txtUserEmail.value;
txtsubject=document.lianxi.txtsubject.value;
txtContent=document.lianxi.txtContent.value;

if(txtUserName.length=="")
 {
  alert("请填写您的姓名!");
  return false;
 }
 if(txtUserTel.length=="")
 {
  alert("请填写您的电话!");
  return false;
 }
if(txtUserEmail.length!=""&&((txtUserEmail.indexOf('@')==-1)||(txtUserEmail.indexOf('.')==-1)))
    {
  alert("邮件地址填写不正确");
  return false;
    }
 if(txtsubject.length=="")
 {
  alert("请填写您的咨询主题!");
  return false;
 }
  if(txtCotnent.length=="")
 {
  alert("请填写您的网站具体需求!");
  return false;
 }
 
 return true;
}
//-->

</script>


Related Information