javascript 调用MediaPlayer实现多曲音乐的播放

如何在网页上实现调用MediaPlayer实现多曲音乐的播放。有很多种方法。我只会一种方法也是最喜欢的一种方法是用javascript。

还是用代码说话...

HEAD标签内加的:

<script type="text/javascript">
  var temp=0;
  function play(){
   var play = document.getElementById("paly")
   
   if(temp==1)
   {
    str="http://listen.idj.126.net/uf/496/8296f194bd164be5ba820b2ddbba6cff.mp3";
   
   }
   else if(temp==2)
   {
    str="http://p.dootnet.com/23/588/63894/04054576.wma";
   
   }
   else if(temp==3)
   {
    str="http://h.5q68.com/music/57.MP3";
   }
   
   play.setAttribute("URL",str); 
  }
  function play2()
  {
   temp++;
   if(temp>3)
   {
    temp=1;
   }
   play();
  }
  </script>

BOOY标签内的内容:

<object id="paly" width=450 height=150 classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6">
        <param name="URL" >
        <param name="rate" value="1">
        <param name="balance" value="0">
        <param name="currentPosition" value="0">
        <param name="defaultFrame" value="">
        <param name="playCount" value="1000">
        <param name="autoStart" value="1">
        <param name="currentMarker" value="0">
        <param name="invokeURLs" value="-1">
        <param name="baseURL" value="">
        <param name="volume" value="50">
        <param name="mute" value="0">
        <param name="uiMode" value="full">
        <param name="stretchToFit" value="0">
        <param name="windowlessVideo" value="0">
        <param name="enabled" value="-1">
        <param name="enablecontextMenu" value="-1">
        <param name="fullScreen" value="0">
        <param name="SAMIStyle" value="">
        <param name="SAMILang" value="">
        <param name="SAMIFilename" value="">
        <param name="captioningID" value="">
      </object>

 

<input type="button" name="button" id="button" value="按钮"  onClick="play2();">

相关推荐