我有一個HTML表單:jQuery的崗位不是每次沃金的Firefox
<form method="post" id="input_form" onSubmit="return save_mail();">
<input type="text" value="enter your email" id="mail" name="mail"/>
<button type="submit" id="save_btn" >Sign up</button>
<div id="warning"></div>
</form>
的JavaScript代碼如下所示:
function validateEmail(email) {
var re = /\[email protected]\S+\.\S+/;
return re.test(email);
}
function wrongEmail() {
document.getElementById("warning").innerHTML="wrong email format";
}
function rightEmail() {
document.getElementById("warning").innerHTML="";
}
function save_mail() {
var pom=document.getElementById("mail").value;
if (validateEmail(pom)) {
$.post("php/sign_up.php", {mail : pom});
rightEmail();
alert("heey"); // if I remove this alert, it doesn't work on FF anymore
return true;
}
else {
wrongEmail();
return false;
}
}
這一切工作正常,在Chrome也火狐,但如果我刪除來自我的JS代碼的警報,它不再工作。我不知道,這怎麼可能。根據FF或Chrome沒有錯誤。