1. 程式人生 > >在HTML中的下拉框中怎樣實現超連接?

在HTML中的下拉框中怎樣實現超連接?

-h light targe 窗口 ext html中 http com tex

給你個例子自己改吧:

<SELECT name="select" onchange="window.open(this.options[this.selectedIndex].value,target=‘_self‘)">
<OPTION value=‘file1.htm‘ selected>網址1</OPTION>
<OPTION value=‘file2.htm‘>網址2</OPTION>
<OPTION value=‘file3.htm‘>網址3</OPTION>
</SELECT>

有多個鏈接就把<OPTION value=‘file3.htm‘>網址3</OPTION>這行內容多復制幾次改一下網址就行了。

上面代碼是鏈接在當前窗口打開,要找開新窗口把target=‘_self‘改為target=‘_blank‘就行了。

在HTML中的下拉框中怎樣實現超連接?