<object id="MediaPlayer" name="MediaPlayer" width="100%" height="64" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">
 <param name="url" value= "1.mp3">
 <param name="AutoStart" value="1">
</object>请问,当1.mp3播放结束之后如何自动播放2.mp3?

解决方案 »

  1.   

    <object id="MediaPlayer" name="MediaPlayer" width="100%" height="64" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">
    <param name="url" value= "1.mp3">
    <param name="AutoStart" value="1">
    </object>
    <script type="text/javascript">var currentMedia = "1.mp3";function playNextMedia() {
    var wmp = document.getElementById("MediaPlayer");
    wmp.URL = currentMedia = (1+parseInt(currentMedia)) + ".mp3";
    wmp.controls.play();
    }</script>
    <script for="MediaPlayer" event="PlayStateChange(NewPlayState)">
        // 1停止 2暂停 3播放 6缓冲 7等待 8播完 10无法播放
        if (NewPlayState == 8) {
            setTimeout(playNextMedia, 1000); // 播放完毕, 1 秒后播放下一首
        } else if (NewPlayState == 10) {
            alert(currentMedia + "无法播放");
        }
    </script>