女性怀孕前检查什么:请问怎么用DW做个菜单或者列表来控制播放哪首背景音乐呢?

来源:百度文库 编辑:高考问答 时间:2024/04/29 12:39:48

下拉选择

脚本说明:
把如下代码加入<body>区域中
<BGSOUND SRC="" LOOP=-1 ID=BgSound>
<SELECT NAME="select" onchange="BgSound.src=this.value">
<OPTION VALUE="" SELECTED>请选择播放音乐</OPTION>
<OPTION VALUE="1.mid">仙俭音乐1</OPTION>
<OPTION VALUE="2.mid">仙俭音乐2</OPTION>
<OPTION VALUE="3.mid">仙俭音乐3</OPTION>
<OPTION VALUE=4.mid">仙俭音乐4</OPTION>
<OPTION VALUE="5.mid">仙俭音乐5</OPTION>
<OPTION VALUE="6.mid">大日子</OPTION>
<OPTION VALUE="7.mid">失忆周末</OPTION>
<OPTION VALUE="8.mid">无忌</OPTION>
<OPTION>[暂止播放]</OPTION>
</SELECT>

随机播放

脚本说明:
把如下代码加入<body>区域中
<SCRIPT language="JavaScript">
<!--
var sound1="song1.mid"
var sound2="song2.mid"
var sound3="song3.mid"
var sound4="song4.mid"
var sound5="song5.mid"
var sound6="song6.mid"
var sound7="song7.mid"
var sound8="song8.mid"
var sound9="song9.mid"
var sound10="song10.mid"
var x=Math.round(Math.random()*9)
if (x==0) x=sound1
else if (x==1) x=sound2
else if (x==2) x=sound3
else if (x==3) x=sound4
else if (x==4) x=sound5
else if (x==5) x=sound6
else if (x==6) x=sound7
else if (x==7) x=sound8
else if (x==8) x=sound9
else x=sound10
if (navigator.appName=="Microsoft Internet Explorer")
document.write('<bgsound src='+'"'+x+'"'+' loop="infinite">')
else
document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="20" height="20" autostart="true" loop="true">')

//-->

</SCRIPT>