我有一個總變量,我使用從PHP/JS的下拉框中更改的刷新獲取請求進行更新。似乎在Firefox中正常工作,但在Chrome/IE中完全沒有問題。有什麼建議麼?Javascript onchange()不適用於Chrome和IE
<form action='cart.php' onchange = 'go()'>
<select id = 'postinfo' name = 'postage'>
<script>
function go() {
var x = document.getElementById("postinfo").value;
if (x == "express") {
var price = 9.99
window.location.href = "cart.php?delivery=" + price + "&item=express";
}else if (x == "free"){
var price = 4.99
window.location.href = "cart.php?delivery=" + price + "&item=free";
}
}
</script>
東西在你的代碼是不正確的。請修復它。爲什麼你有圍繞HTML的報價? – gdoron