辉克's Blog

创造机会的人是勇者;等待机会的人是愚者

selct选择菜单跳转当前窗口或新窗口

HTML中select选择菜单跳转“当前窗口”或“新窗口”
select选择菜单的链接方式主要由onchange来控制,下面是代码:
在新窗口中打开:
select onchange = window.open(this.options[this.selectedIndex].value) name = select
在当前窗口打开: select onchange = 'document.location.href=this.options[this.se…
select选择菜单的链接方式主要由“onchange”来控制,下面是代码:

在新窗口中打开:

01.<select onchange="window.open(this.options[this.selectedIndex].value)" name="select">
在当前窗口打开:

01.<select onchange='document.location.href=this.options[this.selectedIndex].value;'>
下面是实际应用中的完整代码,供大家参考
1、在新窗口中打开 示例代码:

01.<select onchange="window.open(this.options[this.selectedIndex].value)" name="select"> 02.<option value="http://429006.com">Pop's Blog</option> 03.<option value="http://www.qq.com">Tencent</option> 04.<option value="http://www.google.com">Google</option> 05.</select>
2、在当前窗口打开 示例代码:

01.<select onchange='document.location.href=this.options[this.selectedIndex].value;'> 02.<option value="http://429006.com">Pop's Blog</option> 03.<option value="http://www.qq.com">Tencent</option> 04.<option value="http://www.google.com">Google</option> 05.</select>

发表回复