MIDI選播
將這段程式放在<HEAD></HEAD>之中:
<STYLE type="text/css"> <!-- .class1Ac22 {position:absolute; left:0px; top:0px; width:2px; height:2px; clip:rect(0px 2px 2px 0px)} --> </STYLE> <Script Language="JavaScript"> <!-- Original by : jun_aki@m1.people.or.jp --> <!-- Download this script and many more at --> <!-- The Java Magician!! http://run.to/java168 --> <!-- function chaBGMAc22(foName,elName) { if (document.all || document.getElementById || document.layers) { var p,v,emb; p=document.forms[foName].elements[elName]; v=p.options[p.selectedIndex].value; if (v!="defult") { emb='<EMBED SRC="'+v+'" WIDTH="2" HEIGHT="2" LOOP="false" REPEAT="false" AUTOSTART="true">'; writeAc22("BGM",emb); } } } /////////////////////////////////////////////////// function onOffAc22(foName,elName,flag) { if (document.all || document.getElementById || document.layers) { var p,v; p=document.forms[foName].elements[elName]; v=p.options[p.selectedIndex].value; if (flag && v!="defult") { if (document.all) document.embeds[0].play(); else if (document.getElementById) document.embeds[0].play(false); else if (document.layers) document.layers["BGM"].document.embeds[0].play(false); } else if (!flag) { if (document.all) document.embeds[0].stop(); else if (document.getElementById) document.embeds[0].stop(); else if (document.layers) document.layers["BGM"].document.embeds[0].stop(); } } } function writeAc22(name,mes) { if (document.all) document.all(name).innerHTML=mes; else if (document.getElementById) document.getElementById(name).innerHTML=mes; else if (document.layers) { document.layers[name].document.open(); document.layers[name].document.write(mes); document.layers[name].document.close(); } } // End --> </Script>
將這段程式放在<BODY></BODY>之中:<SPAN id="BGM" class="class1Ac22"> <EMBED SRC="tango-a.mid" WIDTH="2" HEIGHT="2" LOOP="false" REPEAT="false" AUTOSTART="false"> </SPAN> <FORM NAME="bgmFo"> <SELECT NAME="bgmList" style="color:#9999FF; background-color:#f1f1ff" onChange='chaBGMAc22("bgmFo","bgmList")'> <OPTION VALUE="defult" SELECTED>-- 請選擇歌曲 -- <OPTION VALUE="rm/laputa.mid">天空之城 <OPTION VALUE="rm/maggie.mid">絕 <OPTION VALUE="rm/cecilia.mid">賭愛 </SELECT> <INPUT TYPE="button" VALUE="Play" style="color:#9999FF; background-color:#f1f1ff" onClick='onOffAc22("bgmFo","bgmList",true)'> <INPUT TYPE="button" VALUE="Stop" style="color:#9999FF; background-color:#f1f1ff" onClick='onOffAc22("bgmFo","bgmList",false)'> </FORM>
注意事項 :
<option value="rm/laputa.mid" style="color:#9999ff">天空之城
"rm/laputa.mid" - 檔案位置
天空之城 - 歌曲名稱
color:# - 字形/背景顏色