Jquery 无法使用Firefox和pear发送邮件
我很困惑,所以请耐心点 我使用pear 1.9.0,我有一个发送电子邮件的简单代码Jquery 无法使用Firefox和pear发送邮件,jquery,html,email,xmlhttprequest,pear,Jquery,Html,Email,Xmlhttprequest,Pear,我很困惑,所以请耐心点 我使用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 mail
<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>
函数contactsendBack(f){
//mes是向用户呈现消息的div
document.getElementById(“mes”).innerHTML=“”;
//如果用户想在textfield中输入一些邮件,但textfield实际上是空的。。。
if(f.elements['pick'].value==“opt”&f.elements['sendm'].value==”){document.getElementById(“mes”).innerHTML=“Duh,无邮件”;返回false;}
//如果用户希望在文本字段中输入一些邮件,并在列表中包含管理员的邮件,但文本字段实际上是空的。。。
else if(f.elements['pick'].value==“admopt”&&f.elements['sendm'].value==”){document.getElementById(“mes”).innerHTML=“Duh,无邮件”;返回false;}
其他的
{
//好的,现在没有错误,所以发送到服务器
post(“contactsendBack.php”,{
名称:f.elements['name'].值,
mymail:f.elements['mymail'].value,
拾取:f.elements['pick'].值,
sendm:f.elements['sendm'].值,
subc:f.元素['subc'].值,
注释:f.elements['comment'].value
},函数(数据){
//呈现contactsendBack.php回声…可能是“发送确定”或“错误”
$('#mes').html(数据);
});
返回false;
}
}
//html
名称:
您的电子邮件:
检查发布到脚本的值,并比较不同的浏览器版本。可能会有一个不同之处——消除它