2016-07-23 62 views
1

我想要在新標籤頁/窗口中打開菜單URL,我不希望它用所需的URL覆蓋當前頁面。消息標題被代碼塊「幫助」所掩蓋。只是爲了表明:我使用_blank,瀏覽器忽略它。爲什麼HTML窗體菜單在同一窗口/選項卡中打開URL?

<FORM name="Menu_1a"> 
 
    <SELECT name="URL" onChange="if(options[selectedIndex].value) 
 
    window.location.href=(options[selectedIndex].value) " style="background-color: #CCFF99; font-weight: bold;"> 
 
    <option value="" selected="selected" style="background-color: #FFCC99; font-weight: bold;">---Select --></option> 
 
    <OPTION value="http://ezaca.tripod.com/index_acco.html" target="_self">Reset this menu</OPTION> 
 
    <!-- this works, except it replaces page instead of opening new --> 
 
    <OPTION value="http://www.jakob-schlaepfer.ch/en/decor/collection-a-m/" target="_blank">Background</OPTION> 
 
    <OPTION value="http://lyricstranslate.com/en/amor-eterno-love-eternal.html">Amor Eterno - Lyrics</OPTION> 
 
    <OPTION value="http://www.youtube.com/watch?v=7QuXKirNX3I">Amor Eterno - R. Durcal</OPTION> 
 
    <OPTION value="http://earthquake.usgs.gov/earthquakes/recenteqsww/Maps/10/260_15.php">Quakes Acapulco</OPTION> 
 
    <OPTION value="http://www.emsc-csem.org/#2w/" target="_blank">Quakes terremoto</OPTION> 
 
    <OPTION value="http://acapulcodejuarez.olx.com.mx/item_page.php?Id=280315985&ts=1321310362/" target="_blank">Advertising - Emilio</OPTION> 
 
    <OPTION value="http://ezaca.tripod.com/acco/sndass/ezlxsndass.html" target="_blank" style="background-color: #FFCC99; font-weight: bold;">Soundassistent for Limex Midi</OPTION> 
 
    <OPTION value="http://ezaca.tripod.com/acco/sndass/ezlxsndass.html" target="_blank" style="background-color: #FFCC99; font-weight: bold;">Klangassistent f&uuml;r Limex Midi</OPTION> 
 
    <OPTION value="http://ezaca.tripod.com/acco/lx_1.htm/#top0">Limex Midi Erfahrungen</OPTION> 
 
    <OPTION value="" style="background-color: Yellow; font-weight: bold;"></OPTION> 
 
    </SELECT> 
 
</FORM>

+0

代碼看起來沒事,你測試了谷歌瀏覽器? – yanguya995

+0

上面的代碼確實在當前窗口「window」中打開了一個新頁面。你說你使用'_blank',但是,呃,在哪裏? –

回答

0

如果你能在你需要的屬性target="_blank"添加到形成一個新的窗口提交form

target屬性指定一個名稱或一個關鍵字,用於指示提交表單後收到的響應的顯示位置。

目標屬性定義瀏覽上下文(例如選項卡,窗口或內聯框架)的名稱或關鍵字。

http://www.w3schools.com/tags/att_form_target.asp

<FORM name="Menu_1a" target="_blank"> 
 
    <SELECT name="URL" onChange="if(options[selectedIndex].value) 
 
    window.location.href=(options[selectedIndex].value) " style="background-color: #CCFF99; font-weight: bold;"> 
 
    <option value="" selected="selected" style="background-color: #FFCC99; font-weight: bold;">---Select --></option> 
 
    <OPTION value="http://ezaca.tripod.com/index_acco.html" target="_self">Reset this menu</OPTION> 
 
    <!-- this works, except it replaces page instead of opening new --> 
 
    <OPTION value="http://www.jakob-schlaepfer.ch/en/decor/collection-a-m/" target="_blank">Background</OPTION> 
 
    <OPTION value="http://lyricstranslate.com/en/amor-eterno-love-eternal.html">Amor Eterno - Lyrics</OPTION> 
 
    <OPTION value="http://www.youtube.com/watch?v=7QuXKirNX3I">Amor Eterno - R. Durcal</OPTION> 
 
    <OPTION value="http://earthquake.usgs.gov/earthquakes/recenteqsww/Maps/10/260_15.php">Quakes Acapulco</OPTION> 
 
    <OPTION value="http://www.emsc-csem.org/#2w/" target="_blank">Quakes terremoto</OPTION> 
 
    <OPTION value="http://acapulcodejuarez.olx.com.mx/item_page.php?Id=280315985&ts=1321310362/" target="_blank">Advertising - Emilio</OPTION> 
 
    <OPTION value="http://ezaca.tripod.com/acco/sndass/ezlxsndass.html" target="_blank" style="background-color: #FFCC99; font-weight: bold;">Soundassistent for Limex Midi</OPTION> 
 
    <OPTION value="http://ezaca.tripod.com/acco/sndass/ezlxsndass.html" target="_blank" style="background-color: #FFCC99; font-weight: bold;">Klangassistent f&uuml;r Limex Midi</OPTION> 
 
    <OPTION value="http://ezaca.tripod.com/acco/lx_1.htm/#top0">Limex Midi Erfahrungen</OPTION> 
 
    <OPTION value="" style="background-color: Yellow; font-weight: bold;"></OPTION> 
 
    </SELECT> 
 
</FORM>

+0

我標記了代碼,使用了ctrl + k。與以前的佈局相比,它看起來不同。 2016年7月26日。儘管擁有20年的在線體驗,但本次論壇的運作對我來說仍然很陌生。我希望我的附加內容不會丟失,我找不到編輯文本的提交按鈕。 – Morphingstar

+0

對不起,但我不明白.. –

相關問題