2013-03-22 82 views
-1
var musicSource = [ 
    "music/sound1.ogg", 
    "music/sound2.ogg", 
    "music/sound3.ogg", 
    "music/sound4.ogg", 
    "music/sound5.ogg", 
    "music/sound6.ogg", 
    "music/sound7.ogg", 
    "music/sound8.ogg", 
    "music/sound9.ogg", 
    "music/sound10.ogg" 
]; 

var rand = Math.floor(Math.random()*musicSource.length); 
document.write('<object><param name="autostart" value="true"><param name="src" value="'+musicSource[rand]+'"><param name="autoplay" value="true"><param name="controller" value="true"><embed id="vol" src="'+musicSource[rand]+'" hidden="true" controller="true" autoplay="true" autostart="true" type="audio/ogg" loop="true"/></object>'); 
var musicSource=document.getElemenetById('vol').getSVGDocument(); musicSource.volume=.20; 

我嘗試的一切從來沒有工作。我試圖把音量=「20」,我也試圖獲得id。我甚至在index.php <div id="vol" />我怎麼會把數量放進去?

哦,我很抱歉,我不知道我在做什麼,我來得到一些幫助,我幾乎被稱爲愚蠢。謝謝你們,這裏是最棒的。 -_-

+1

你想做什麼? 'getSVGDocument()'? – Raptor 2013-03-22 02:25:49

+0

-1:那個document.write的東西太可怕了! – kay 2013-03-22 02:28:44

回答