作者porphur (我要看RENT)
看板Web_Design
標題[問題] 請問下拉式跳頁選單的連結(已爬文)
時間Sun Jan 1 17:19:09 2006
我在我的blog加上幾個下拉式跳頁選單
我想要按下選項之後在新視窗開啟
可是在<option>裡加入target="_blank"了
卻還是在同一個頁面換頁
請問要怎樣改成可以在新視窗開啟呢?
我的原始碼:
1. 貼在<head>...</head>中間的:
<SCRIPT TYPE="text/javascript">
<!--
function dropdown(mySel)
{
var myWin, myVal;
myVal = mySel.options[mySel.selectedIndex].value;
if(myVal)
{
if(mySel.form.target)myWin = parent[mySel.form.target];
else myWin = window;
if (! myWin) return true;
myWin.location = myVal;
}
return false;
}
//-->
</SCRIPT>
2. 貼在<body>....</body>中間的:
<SELECT ONCHANGE="location = this.options[this.selectedIndex].value;">
<OPTION VALUE="">Choose a Musical...
<OPTION VALUE="
http://www.avenueq.com/" target="_blank">-- Avenue Q
<OPTION VALUE="
http://www.fossethemusical.com/" target="_blank">-- Fosse
<OPTION VALUE="
http://www.hairsprayonbroadway.com/" target="_blank">--
Hairspray
<OPTION VALUE="
http://disney.go.com/disneytheatrical/thelionking/"
target="_blank">-- Lion King, the
<OPTION VALUE="
http://www.montypythonsspamalot.com/" target="_blank">-- Monty
Python's Spamalot
<OPTION VALUE="
http://www.musicals.nl/passion/" target="_blank">-- Passion
<OPTION VALUE="
http://www.producersonbroadway.com/" target="_blank">--
Producers, the
<OPTION VALUE="
http://www.siteforrent.com/" target="_blank">-- Rent
<OPTION VALUE="
http://www.reallyuseful.com/rug/shows/sunset/"
target="_blank">-- Sunset Boulevard
<OPTION VALUE="
http://www.modernmillietour.com/" target="_blank">--
Thoroughly Modern Millie
</SELECT>
感謝各位!!!
--
AMETHYSTOPHILE
我愛紫水晶
http://amethystophile.blogspot.com/
編碼記得調成unicode才能看
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.59.122.160
※ 編輯: porphur 來自: 61.59.122.160 (01/01 17:57)