[轉]◆°﹏隨機播放器+背景音樂/語法!..*3個*〕〕
以下語法係轉貼!!!
借左要回唷~!十卜..十卜!
*************************************
1:播放器語法
<script language="javascript">
<!--
function my_get_stop() {
document.all.music_show.innerHTML='music off';
}
function my_get_music() {
var songurl,songname,all,value;
songurl =new Array();
songname =new Array();
all =6; //歌曲總數
//歌曲
songurl[0] ='歌曲網址';
songurl[1] ='歌曲網址';
songurl[2] ='歌曲網址';
songurl[3] ='歌曲網址';
songurl[4] ='歌曲網址';
songurl[5] ='歌曲網址';
//歌名
songname[0] ='歌名';
songname[1] ='歌名';
songname[2] ='歌名';
songname[3] ='歌名';
songname[4] ='歌名';
songname[5] ='歌名';
value=Math.round(Math.random()*(all-1));
document.all.music_show.innerHTML=songname[value];
document.all.music_show.innerHTML+='<embed src="'+songurl[value]+'" autostart="true" loop=infinite hidden>';
}
onload=my_get_music;
//-->
</script>
<a href="javascript:my_get_music();"><img src="http://home.pchome.com.tw/funny/mm9346/arrow/arrow39.gif"alt="next"border="0"></a> <marquee scrollamount=2 bgcolor=#AAAAAA width=160 style="border:1px dotted #000000"><font color="#000000" size=1 face="Verdana">now:<font id="music_show"></font></marquee> <a href="javascript:my_get_stop();"><img src="http://home.pchome.com.tw/cute/m9346/img2/close1.gif"alt="stop"border="0"></a>
*************************************
2:隨機播放2
每進入一次,會自動轉音樂
想加音樂可自行試試
Array(4); 及 tips[3]
可更改數值、增加音樂
<SCRIPT Language="JavaScript">
tips = new Array(4);
tips[0] = "音樂網址";
tips[1] = "音樂網址";
tips[2] = "音樂網址";
tips[3] = "音樂網址";
index = Math.floor(Math.random() * tips.length);
document.write("<EMBED SRC=" + tips[index] + " autostart=true width=0 height=0 loop=true hidden=TRUE></EMBED>");
</SCRIPT>
*************************************
3:背景音樂
<bgsound src="音樂網址" loop="-1">
*************************************
|