<form name="test">
<select name="choose" style="width:300px;">
<option selected="">Select option</option>
<option value="http://url.com">Test</option>
</select>
<input onclick="location=document.test.choose.options[document.test.choose.selectedIndex].value;" value="Take me there!" type="button"></p>
</form>
Run Code Online (Sandbox Code Playgroud)
我使用以下内容制作下拉列表,只是想知道如何在新标签页中选择打开,而不是在自己的窗口中
工作正常,因为它只需要在新选项卡中打开.
*编辑*
这需要工作,谢谢
<input onClick="window.open(document.test.choose.options[document.test.choose.selectedIndex].value);" value="Take me there!" type="button">
Run Code Online (Sandbox Code Playgroud)
HAD*_*ADI 18
试试window.open
window.open('http://www.google.com');
Run Code Online (Sandbox Code Playgroud)
现场演示 - http://jsfiddle.net/im4aLL/tzp4H/