音乐播放

HTML代码:
<!--播放器 开始-->
<object id="Exobud" style="width: 273px; height: 64px" type="application/x-oleobject"
  classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
  <param name="URL" value=""/>
  <param name="rate" value="1"/>
  <param name="balance" value="0"/>
  <param name="currentPosition" value="0"/>
  <param name="defaultFrame" value=""/>
  <param name="playCount" value="1"/>
  <param name="autoStart" value="1"/>
  <param name="currentMarker" value="0"/>
  <param name="invokeURLs" value="-1"/>
  <param name="baseURL" value=""/>
  <param name="volume" value="80"/>
  <param name="mute" value="0"/>
  <param name="uiMode" value="full"/>
  <param name="stretchToFit" value="-1"/>
  <param name="windowlessVideo" value="0"/>
  <param name="enabled" value="-1"/>
  <param name="enableContextMenu" value="0"/>
  <param name="fullScreen" value="0"/>
  <param name="SAMIStyle" value=""/>
  <param name="SAMILang" value=""/>
  <param name="SAMIFilename" value=""/>
  <param name="captioningID" value=""/>
  <param name="enableErrorDialogs" value="0"/>
  <param name="_cx" value="7223"/>
  <param name="_cy" value="1693"/>
</object> <!--播放器 结束-->
<select name="SongList" size="5" ondblclick="player();" >
       <option value="1.mp3">001</option>
       <option value="2.mp3">002</option>
       <option value="3.mp3">003</option>
</select> <br />

<a href="#" onclick="javascript:play();">播放</a>
<a href="#" onclick="javascript:Last_OneOK();">上一首</a>
<a href="#" onclick="javascript:Next_OneOK();">下一首</a>

JS代码:
<script language="JavaScript" type="text/javascript">
        var SongList = document.getElementById("SongList");
        var Exobud = document.getElementById("Exobud");
        var TotalSongs = SongList.options.length;
        function play()
        {
        SongList.options[0].selected=true;
        player();
        }
        function player(){
      if(SongList.selectedIndex < 0) alert('系统错误,请选择您要播放的曲目!');
      else{
      var url;
      url = SongList.options[SongList.selectedIndex].value;
      Exobud.URL=url;
      Exobud.controls.play();
      showTLab();
      return;
      }
        }
    
        function showTLab(){
      if(Exobud.playState == 1)
      Next_OneOK();
      setTimeout("showTLab()", 1000);
        }
    
        function Next_OneOK(){
      if(SongList.selectedIndex >= 0){
      if(SongList.selectedIndex < TotalSongs-1){
       SongList.options[SongList.selectedIndex + 1].selected = true;
        player();
      }else{
       SongList.options[0].selected = true;
        player();
      }
       }
         }
         function Last_OneOK(){
      if((SongList.selectedIndex > 0) && (SongList.selectedIndex < TotalSongs)){
      SongList.options[SongList.selectedIndex - 1].selected = true;
      player();
         }
         }
</script>

你可能感兴趣的:(JavaScript,html,object,function,url,音乐)