我嘗試重定向頁面取決於用戶是否在下拉菜單中選擇「標準」或「維護」。 Hoewever我的JavaScript不太工作。你能幫我指點我哪裏錯了嗎?JavaScript重定向頁面基於選定的值
在此先感謝。
<script type="text/javascript">
<!--
function formType(value){
if (value == 'maintenance') {
window.location = "index.php?requestType=maintenance";
} else {
window.location = "index.php?requestType=standard";
}
-->
</script>
<select id="changer" name="type" onchange="formType(this.value);">
<option value="standard" <?php if ($requestType == 'standard') { echo "selected"; } ?>>Standard</option>
<option value="maintenance" <?php if ($requestType == 'maintenance') { echo "selected"; } ?>>Maintenance</option>
</select>
'function formType(value){window.location =「index.php?requestType =」+ value; }' –