Javascript onchange()在chrome和IE中不起作用

JP2*_*P29 0 javascript

我有一个总变量,我使用PHP/JS下拉框中的更改时使用刷新获取请求更新.似乎在Firefox中运行良好,但与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>
Run Code Online (Sandbox Code Playgroud)

epa*_*llo 5

表单元素上没有onchange事件.

你可能想在select元素上使用它.