<html>
<head>
</head>
<body>
<object id="mediaplayer" codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" width="347" height="64" type="application/x-oleobject" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" standby="Loading Windows Media Player components...">
<param name="url" value=""/>
<param name="Mute" value="false"/>
<param name="AutoStart" value="true"/>
<param name="EnableContextMenu" value="false"/>
<param name="SendMouseMoveEvents" value="false"/>
<param name="SendMouseClickEvents" value="false"/>
<param name="SendKeyboardEvents" value="false"/>
<param name="InvokeURLs" value="false"/>
<param name="PlayCount" value="100"/>
<param name="DefaultFrame" value="datawindow"/>
<param name="Volume" value="100"/>
</object>
<script language="javascript">
var play = document.getElementById("mediaplayer") ;
var musicList = new Array(2) ;
var index = 0 ;
musicList[0] = "E:/音乐/群星 手牵手.mp3" ;
musicList[1] = "E:/音乐/群星 承诺.mp3" ;
setInterval("playMusic()", 1000) ;
function playMusic()
{
if(play.url == "" || index == musicList.length)
{
index = 0 ;
play.url = musicList[index] ;
}
if((parseInt(play.currentMedia.duration) - 1) == parseInt(play.controls.currentPosition))
{
play.url = musicList[++index] ;
}
}
</script>
</body>
</html>
可能有错误 play.currentMedia.duration
(二)
<embed src="songlist.m3u" autostart="true" loop="-1" controls="ControlPanel" width="0" height="0" >
另一文件 songlist.m3u
<ASX version="3.0">
<ENTRY>
<REF HREF="music/BrilliantFuture.mp3"/>
</ENTRY>
<ENTRY>
<REF HREF="music/zhdwl.mp3"/>
</ENTRY>
</ASX>