网页中播放音乐的实现方法代码

第一种方式:采用wmplayer控件

<object name="wmplayer" classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95 width=0 height=0
codebase=http://activex.microsoft.com/ activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701
height=180 id=MIDIPlayer type=application/x-oleobject VIEWASTEXT standby=" 加载 Microsoft Windows Media Player 组件...">

<param name="FileName" value=" http://yourURL/xxx.wma">
<param name="AutoStart" value="true">
<param name="AutoRewind" value="-1">
<param name="AnimationAtStart" value="false">
<param name="ShowControls" value="false">
<param name="ClickToPlay" value="false">
<param name="EnableContextMenu" value="true">
<param name="EnablePositionControls" value="false">
<param name="Balance" value="0">
<param name="ShowStatusBar" value="false">
<param name="AutoSize" value="0">

<embed type="application/x-mplayer2"
pluginspage="http:// www.microsoft.com/Windows/ Downloads /Contents/Products/MediaPlayer/"
filename src autostart="false" enablecontextmenu="false" clicktopla
y="false" enablepositioncontrols="false" showcontrols="0" showstatusbar="1" showdisplay="0">

</object>

第二种方式:html标签,似乎更简单

<bgsound id='bgsound' src="http://yourURL/xxx.mid" loop=-1 >
  <input type="button" value="停止" onclick="_stop()">
  <input type="button" value="开始" onclick="_start()">
  <script language="JavaScript">
  function _start() {
   bgsound.src = "http://yourURL/xxx.mid";
  }
  function _stop(){
   bgsound.src = "";
  }
  </scrip>

 

 

来源:http://www.cnblogs.com/88223100/archive/2008/09/02/1282361.html

你可能感兴趣的:(音乐)