随机播放音乐的代码介绍
随机播放音乐的代码介绍
下面是随机播放音乐的代码
<script>
var nummidi = 7
day = new Date()
seed = day.getTime()
ran = parseInt(((seed - (parseInt(seed/1000,10) * 1000))/10)/100*nummidi + 1,10)
if (ran == (1)) midi=("http://ftp.cumt.edu.cn/cumtonline/music/music4/banderui/Windmills.mp3")
if (ran == (2)) midi=("http://ftp.cumt.edu.cn/cumtonline/music/music4/banderui/Diamonds.mp3")
if (ran == (3)) midi=("http://ftp.cumt.edu.cn/cumtonline/music/music4/banderui/Spring%2DWater.mp3")
if (ran == (4)) midi=("http://ftp.cumt.edu.cn/cumtonline/music/music4/banderui/Melody%2DOf%2DHope.mp3")
if (ran == (5)) midi=("http://ftp.cumt.edu.cn/cumtonline/music/music4/banderui/Moutain-Stream.mp3")
if (ran == (6)) midi=("http://ftp.cumt.edu.cn/cumtonline/music/music3/beyond/%C7%E9%C8%CB.mp3")
if (ran == (7)) midi=("http://ftp.cumt.edu.cn/cumtonline/music/music3/beyond/%BA%A3%E9%9F%CC%EC%BF%D5.mp3")
document.write('<bgsound SRC= "' + midi + '" volume=100 controls=smallconsole loop=-1 HSPACE=3 WIDTH=48 HEIGHT=26 AUTOSTART=TRUE>')
// -->
</script><br>