【发布时间】:2011-12-20 16:05:54
【问题描述】:
我尝试根据用户在下拉菜单中选择“标准”还是“维护”来重定向页面。 Hoewever 我的 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; }
标签: javascript select redirect window.location