Flash播放:
<body scroll="no" onload="ChangePaper();" leftMargin="0" topMargin="0">
<object id=Flash classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 height=100% width=100%>
<param name='Movie' value='DigitalSky.swf'>
<param name='Scale' value='ShowAll'>
<param name='Menu' value='false'>
<param name="Loop" value="false">
</object>
<script>
function ChangePaper()
{
Flash.Movie="DigitalSky.swf";
setTimeout("if(!Flash.Playing){Flash.Play();}",1000);
}
</script>
</body>

解决方案 »

  1.   

    MP3播放
    <HTML>
    <HEAD>
      <TITLE>MP3播放器</TITLE>
      <SCRIPT language=javascript event=OpenComplete for=Player>
        Player_OpenComplete()
      </SCRIPT>  <SCRIPT language=javascript event=PositionChange for=Player>
        Player_PositionChange()
      </SCRIPT>  <SCRIPT language=javascript event=Timer for=Player>
        Player_Timer()
      </SCRIPT>  <SCRIPT language=javascript event=StateChange for=Player>
        Player_StateChange()
      </SCRIPT>
    </HEAD><BODY language=javascript leftMargin=0 topMargin=0 onload="PlayInit()">
    <br><br><br>
    <center>
    <table width="390" height="121" background="MP3bg.gif" border=0 cellSpacing=0 cellPadding=0 borderColorDark=#FFFFFF borderColorLight=#ff0000>
      <tr>
       <td height="18" width="22"></td>
       <td height="18" width="87"></td>
       <td height="18" width="87"></td>
       <td height="18" width="72"></td>
       <td height="18" width="83"></td>
       <td height="18" width="27"></td>
      </tr>  <tr>
       <td height="27" width="22"></td>
       <td height="27" width="87"></td>
       <td height="27" width="246" colspan="3"><LABEL id=FileNameLabel style="FONT-SIZE: larger; COLOR: blue"></LABEL></td>
       <td height="27" width="27"></td>
      </tr>  <tr>
       <td height="31" width="22"></td>
       <td height="31" width="87"></td>
       <td height="31" width="87" align=center><LABEL id=TimeLabel style="FONT-SIZE: larger; COLOR: blue">00:00</LABEL></td>
       <td height="31" width="72">
        
       </td>
       <td height="31" width="83" align="center"><LABEL id=LengthLabel style="FONT-SIZE: larger; COLOR: blue">00:00</LABEL></td>
       <td height="31" width="27"></td>
      </tr>
      <tr>
       <td height="22" width="22"></td>
       <td height="22" width="87"></td>
       <td height="22" width="246" colspan="3" align=center><DIV id=Progress style="LEFT: 115px; WIDTH: 240px;BACKGROUND-COLOR: red"></DIV></td>
       <td height="22" width="27"></td>
      </tr>  <tr>
       <td colspan="6" align=center valign=bottom height="20" width="388"></td>
      </tr>
      <tr>
      <td colspan="6" align=center valign=bottom height="20" width="388">
       <IMG id=OpenBtn onclick="OpenBtn()" alt=FileOpen  src="open.gif" width=55><IMG id=PlayBtn onclick="PlayBtn()" alt=Play    src="play.gif" width=55><IMG id=StopBtn onclick="StopBtn()" alt=Stop    src="stop.gif" width=55><IMG id=PauseBtn onclick="PauseBtn()" alt=Pause   src="pause.gif" width=55><IMG id=RewBtn  onclick="RewBtn()"  alt=Rewind   src="rew.gif"  width=55><IMG id=FFBtn  onclick="FFBtn()"  alt=FastFoward src="FF.gif"  width=55 height="29">
      </td>
      </tr>
      <tr>
      <td colspan="6" align=center valign=bottom height="4" width="388"></td>
      </tr>
    </table>
    </center>   
      
        
    <OBJECT id=Player style="VISIBILITY:hidden;" height=10 width=10 classid=clsid:05589FA1-C356-11CE-BF01-00AA0055595A>    
      <PARAM NAME="Appearance" VALUE="0">    
      <PARAM NAME="AutoStart" VALUE="0">    
      <PARAM NAME="AllowChangeDisplayMode" VALUE="-1">    
      <PARAM NAME="AllowHideDisplay" VALUE="0">    
      <PARAM NAME="AllowHideControls" VALUE="-1">    
      <PARAM NAME="AutoRewind" VALUE="-1">    
      <PARAM NAME="Balance" VALUE="0">    
      <PARAM NAME="CurrentPosition" VALUE="0">    
      <PARAM NAME="DisplayBackColor" VALUE="0">    
      <PARAM NAME="DisplayForeColor" VALUE="16777215">    
      <PARAM NAME="DisplayMode" VALUE="0">    
      <PARAM NAME="Enabled" VALUE="-1">    
      <PARAM NAME="EnableContextMenu" VALUE="-1">    
      <PARAM NAME="EnablePositionControls" VALUE="-1">    
      <PARAM NAME="EnableSelectionControls" VALUE="0">    
      <PARAM NAME="EnableTracker" VALUE="-1">    
      <PARAM NAME="Filename" VALUE="">    
      <PARAM NAME="FullScreenMode" VALUE="0">    
      <PARAM NAME="MovieWindowSize" VALUE="0">    
      <PARAM NAME="PlayCount" VALUE="1">    
      <PARAM NAME="Rate" VALUE="1">    
      <PARAM NAME="SelectionStart" VALUE="-1">    
      <PARAM NAME="SelectionEnd" VALUE="-1">    
      <PARAM NAME="ShowControls" VALUE="-1">    
      <PARAM NAME="ShowDisplay" VALUE="0">    
      <PARAM NAME="ShowPositionControls" VALUE="0">    
      <PARAM NAME="ShowTracker" VALUE="-1">    
      <PARAM NAME="Volume" VALUE="-830">    
    </OBJECT>    
    <INPUT type=file id=FileBtn style="VISIBILITY:hidden;">        
            
    <SCRIPT language=javascript>var OldPos, Length, Width function PlayInit()
    {
     OldPos = 0    
     Width = Progress.style.posWidth    
     Progress.style.posWidth = 0 
    }function Player_OpenComplete(){Length=Player.Duration;LengthLabel.innerText=FormatTime(Length);}
    function Player_Timer()
    {
     var CurPos
     CurPos=Math.floor(Player.CurrentPosition) 
     alert(CurPos)
     if ( CurPos != OldPos )
     {
      OldPos=CurPos
      TimeLabel.innerText=FormatTime(CurPos)
      Progress.style.posWidth=(Width * CurPos)/Length
     }
    }function Player_PositionChange()
    {
     TimeLabel.innerText=FormatTime(Player.CurrentPosition)
     Progress.style.posWidth=(Width * Player.CurrentPosition) / Length
    }function Player_StateChange()    
    {    
     if(Player.CurrentState==0){TimeLabel.innerText = FormatTime(0);Progress.style.posWidth=0}
    }
    function OpenBtn()

     var fstr=''
     FileBtn.click()    
     if (FileBtn.value=='') return
     Player.FileName=FileBtn.value
     fstr=FileBtn.value
     var temparr=fstr.split('\\')
     FileNameLabel.innerText= ' ' + temparr[temparr.length-1]
     Player.Run()
    }function PlayBtn(){Player.Run()}function StopBtn(){Player.Stop()}function PauseBtn(){Player.Pause()}function RewBtn(){Player.CurrentPosition=Player.CurrentPosition-10}function FFBtn(){Player.CurrentPosition=Player.CurrentPosition+10}function FormatTime(value)
    {
     var min, sec, str
     min=Math.floor(value / 60)
     sec=Math.floor(value % 60)
     if (isNaN(min)){return "00:00"}
     if (min>9){str=min.toString() + ":"}else{str="0" + min.toString() + ":"}
     if (sec>9){str=str + sec.toString()}else{str=str + "0" + sec.toString()}
     return str
    }
    </SCRIPT></BODY></HTML>
      

  2.   

    第二种就适合wma,关键看你Window Media Play装插件没有.