Javascript根据之前的选择选择框

时间:2010-03-18 15:10:29

标签: javascript select onclick

如何确保不会在新窗口中打开?

onclick="ob=this.form.table;window.open(ob.options[ob.selectedIndex].value)"/>

3 个答案:

答案 0 :(得分:1)

您应该将其替换为:

onclick="ob=this.form.table;document.location=ob.options[ob.selectedIndex].value;"/>

Window.open()打开一个新窗口; document.location更改当前窗口中的页面。

答案 1 :(得分:1)

如果你想在同一窗口打开你需要写

onclick="ob=this.form.table;window.location.href=(ob.options[ob.selectedIndex].value)"/>

答案 2 :(得分:0)

你想让它在同一个窗口中打开吗?

如果是,请使用window.location

相关问题