HTML 帮改下这几行代码

来源:百度知道 编辑:UC知道 时间:2024/09/26 13:59:38
很简单的代码,就是改下让新开的网页不要新建窗口,直接在本窗口打开,应该怎么改?
<html>
<head>
</head>
<body>
<select onchange="if (this.selectedIndex!=0) window.open(this.value)

target=_blank">
<option selected>=选择网页=</option>
<option value="http://www.baidu.com">百度搜索</option>
<option value="http://www.google.com">谷歌搜索</option>
</select>
</body>
</html>

把 window.open(this.value) 改成:window.location.href=this.value

<html>
<head>
</head>
<body>
<select onchange="if (this.selectedIndex!=0) window.open(this.value)

target=_self">
<option selected>=选择网页=</option>
<option value="http://www.baidu.com">百度搜索</option>
<option value="http://www.google.com">谷歌搜索</option>
</select>
</body>
</html>

把下面的内容:
window.open(this.value)

如下修改即可:
location.href=this.value