0

我很困惑所以请耐心等待

我使用 pear 1.9.0,我有这个简单的代码来发送电子邮件。

 <script type='text/javascript'>
function contactsendBack(f){
   //mes is a div to render messages to the user
    document.getElementById("mes").innerHTML="";

   //if the user wants to input some mails to the textfiled, but the textfield is actually empty...
   if(f.elements['pick'].value=="opt"  && f.elements['sendm'].value=="" ){  document.getElementById("mes").innerHTML="Duh, no mails"; return false;}

   //if the user wants to input some mails to the textfiled and also include admin's mail to the list, but the textfield is actually empty...
   else if (f.elements['pick'].value=="admopt"&& f.elements['sendm'].value==""){document.getElementById("mes").innerHTML="Duh, no mails"; return false;}
   else
      {
                  //ok, no errors now, so send to server
             jQuery.post("contactsendBack.php", { 
              name : f.elements['name'].value ,
              mymail : f.elements['mymail'].value ,
              pick : f.elements['pick'].value ,
              sendm : f.elements['sendm'].value ,
              subj : f.elements['subj'].value ,
              comment : f.elements['comment'].value 


              }, function(data) {
             //render what  contactsendBack.php echos...could be "send ok" or "error"
              $('#mes').html(data);
               });   

       return false;

       }
    }

     </script>


//        the html
        <form  action="#"  onSubmit="return contactsendBack(this); return false;" method="post" enctype="multipart/form-data">   
        Name:<br>
        <input name="name" id="name" type="text" required ><br>
        Your e-mail:<br>
        <input name="mymail" id="mymail" type="email"  value="<?php echo $defm ?>" required ><br>

        <input type="radio" id="pick" name="pick" value="adm" checked = "checked">Admin<br>
        <input type="radio" id="pick" name="pick" value="opt">What I set to the textbox<br>
        <input type="radio" id="pick" name="pick" value="admopt">Admin AND What I set to the textbox<br>
        <input type="radio" id="pick" name="pick" value="all">Everyone<br>


        Set some mails:<br>You can input more than one mail. Separate by commas<br>
        <input name="sendm" id="sendm" type="textarea"  rows="24" cols="50"  ><br>

        Subject:<br>
        <input name="subj" id="subj" type="text"  required><br>
        Text :<br>
        <input name="comment" id="comment" type="textarea"  rows="24" cols="50"  required >
         <br>

         <input type="reset"  id="res" name="res"/>
         <input type="submit" id="sub" name="sub"/>
        </form>

这适用于 Chrome。回声“发送成功”,我可以在我的邮件帐户中看到一封新邮件。但在 Firefox 和 IE 中回显“send ok”,我的帐户中没有看到新邮件。

我也使用 j-query 1.8.2

我在 IE 和 FF 控制台中没有看到任何错误。

我只是不明白。与浏览器有关吗?服务器端(contactsendBack.php)?前端?

我该如何解决?

有任何想法吗?我卡住了

谢谢

4

1 回答 1

0

检查您发布到脚本的值并比较不同的浏览器版本。可能会有差异 - 消除它。

于 2013-10-08T06:24:46.347 回答