|
藍森林 http://www.lslnet.com 2006年8月25日 8:28
請教背景音樂的播放問題!!
請問如何在背景中插入多個音樂,在刷新頁面是不會重複背景音樂! |
前3天的帖子裡有。 |
謝謝。。我不是要他只是隨機播放。。。。
我是要在打開一個頁面是隨機播放背景音樂,但是遊客也可以選擇自己喜歡的背景音樂。。。。。呵呵! |
下載一個音樂播放器放在頁面裡不就行了 |
我好菜。。。你能說詳細一點嗎。。。謝謝! |
怎麼就沒一個好點的建議嗎。。。。。。。 |
能實現嗎?我覺得很難哦! |
是不是可以在網頁上做一個按扭來控制背景音樂,可是其他的音樂我怎麼控制呢。。 |
怎麼沒有大蝦近來幫忙啊。。。。 |
我頂。。。。 |
[html]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
var aryBckSound = []
aryBckSound[0] = "../sound/CMNTY_01.MID"
aryBckSound[1] = "../sound/CARBN_01.MID"
aryBckSound[2] = "../sound/BABY_01.MID"
aryBckSound[3] = "../sound/EAST_01.MID"
aryBckSound[4] = "../sound/EXPLR_01.MID"
aryBckSound[5] = "../sound/FALL_01.MID"
var i = Math.floor(Math.random()*aryBckSound.length)
if ( i==aryBckSound.length ) i--
</script>
</head>
<body>
<script>
document.write("<embed src=\""+aryBckSound[i]+"\" autostart=\"true\" loop=\"true\" nosave=\"true\" hidden=\"true\"></embed>")
</script>
</body>
</html>
[/html]
簡單的例子, |
樓上的兄弟。。。。我把它全考了運行不了啊。。。。 |
我只是給您寫了個例子,您應該根據具體情況,作具體分析.
例如上邊數組中定義的背景音樂路徑,就可以替換成自己的,
還有embed的各個屬性您也可以自己設置!!
此鏈接中有關於embed的簡單說明:
http://www.netstrider.com/tutorials/HTMLRef/commands/embed.html
|
路徑我換了。。只是是用mp3格式的。。。
我一打開他就自己自動關閉了。。。 |
看來是有問題,
你把document.write("<embed src=\""+aryBckSound[i]+"\" autostart=\"true\" loop=\"true\" nosave=\"true\" hidden=\"true\"></embed>")
修改為:
document.write("<embed src=\""+aryBckSound[i]+"\" type=\"audio/mp3\" autostart=\"true\" loop=\"true\" nosave=\"true\" hidden=\"true\"></embed>") |
還是會自動關閉網頁。。。。。 |
那不好意思,我不知道什麼具體原因了,我這裡是可以的,:(
您可以去google搜索一下關於循環播放背景音樂的js代碼, |
如果是單個的循環背景音樂只要加下面的代碼就可以了。。
<bgsound src=sound/001.MP3" loop = "-1">
|
那樣你就把上邊的<embed>替換成<bgsound>就ok了,修改後的代碼就應該是
[html]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script type="text/javascript">
var aryBckSound = [] //背景音樂文件路徑
aryBckSound[0] = "../sound/CMNTY_01.MID"
aryBckSound[1] = "../sound/CARBN_01.MID"
aryBckSound[2] = "../sound/BABY_01.MID"
aryBckSound[3] = "../sound/EAST_01.MID"
aryBckSound[4] = "../sound/EXPLR_01.MID"
aryBckSound[5] = "../sound/FALL_01.MID"
var i = Math.floor(Math.random()*aryBckSound.length) //取得隨機數
if ( i==aryBckSound.length ) i-- //如果隨機數超過數組長度,則減1
</script>
</head>
<body>
<script type="text/javascript">
document.write("<bgsound src=\""+aryBckSound[i]+"\" loop=\"-1\">")
</script>
</body>
</html>
[/html]
|
謝謝樓上的朋友。。。。ok了。。 |
誰能告訴我怎麼加一個打開/關閉背景音樂的按扭嗎? |
如果是 <bgsound id="omusic">
omusic.play()
omusic.stop()
如果是media player控件
playerID.controls.play()
playerID.controls.stop() |
我最討厭背景音樂。一打開有背景音樂的網,我的電腦就變成蝸牛一樣慢。落後了。 |
謝謝二位。。。我也是沒辦法。。。做個班級校友錄。。。大家都建議要有背景音樂。。。 |
我是菜鳥。。板主能說具體點嗎。。。謝謝。了。。。。 |
謝謝! |
lsfilm在上個帖子中說
收藏的一個關閉背景音樂的東東:http://bbs.blueidea.com/viewthread.php?tid=1396471 |
pmessanger在上個帖子中說
不行呀 我試了 不好使呀 |
腳本不能運行,是我機子的問題?怎麼解決? |
http://blueyr.com/down/soft.asp?id=88
這有背景音樂播放器下載 |
chika在上個帖子中說
音樂路徑能不能是本機上的啊。。。 |
不能 |
以上說的幾個腳本全都不能運行的! |
我這裡可一呀。。。 |
用用這個吧!!!可以選擇兩大播放器支持的文件(media & real)而且還可以選擇本地文件和網絡文件,一起進行播放呦!!!
地址:
http://new.digichina.net/bbs/newsdetail.asp?id=1342381&posts=currentposts |
|