怎样控制网页背景音乐的播放
如题,我这样写有错误,不知道要怎样修改<SCRIPT language="JavaScript">
<!--
var sound1="images/1.mid"
var sound2="images/2.mid"
var sound3="images/3.mid"
var x=Math.round(Math.random()*3)
if (x==0) x=sound1
else if (x==1) x=sound2
else x=sound3
if (navigator.appName=="Microsoft Internet Explorer")
document.write('<bgsound src='+'"'+x+'"'+' loop="infinite"'+'"id="soundctl"'+' >')
else
document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="20" height="20" autostart="true"
loop="true"'+'"id="soundctl"'+' >')
function dosound()
{
if(document.getElementById("soundctl").src!="")
{
document.getElementById("soundctl").src=""
}
else
{
document.getElementById("soundctl").src=x
}
}
//-->
</SCRIPT>
<input type=button onclick="dosound()" value="test bgsound">