- JScript code
<embed id="realplayer" src="http://k2.dj2t.com/my/200801/025.rm" width=328 height=68 type="audio/x-pn-realaudio-plugin" controls="StatusBar,ControlPanel" autostart="true" loop="true"> <a href="#" onclick="javascript:document.getElementById('realplayer').DoPlay();">Play</a> <a href="#" onclick="javascript:document.getElementById('realplayer').DoPause();">Pause</a>
注:IE正常,FF却没反应,查了很多还是不得解,也见过前辈们的帖子http://topic.csdn.net/t/20061130/09/5195917.html但都不是想要的,因为那不是控制realplayer格式的文件
------解决方案--------------------
- HTML code
<script> function play(id,url,mode){ var Madie='',Real='' Madie+="<object id='mplayer' width='300' height='50' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' align='baseline' border='0' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>\r\n" Madie+="<param name='FileName' value='" Madie+=url+"'>\r\n" Madie+="<param name='ShowControls' value='1'>\r\n" Madie+="<param name='ShowPositionControls' value='0'>\r\n" Madie+="<param name='ShowAudioControls' value='1'>\r\n" Madie+="<param name='ShowTracker' value='1'>\r\n" Madie+="<param name='ShowDisplay' value='0'>\r\n" Madie+="<param name='ShowStatusBar' value='1'>\r\n" Madie+="<param name='AutoSize' value='0'>\r\n" Madie+="<param name='ShowGotoBar' value='0'>\r\n" Madie+="<param name='ShowCaptioning' value='0'>\r\n" Madie+="<param name='AutoStart' value='1'>\r\n" Madie+="<param name='PlayCount' value='0'>\r\n" Madie+="<param name='AnimationAtStart' value='0'>\r\n" Madie+="<param name='TransparentAtStart' value='0'>\r\n" Madie+="<param name='AllowScan' value='0'>\r\n" Madie+="<param name='EnableContextMenu' value='1'>\r\n" Madie+="<param name='ClickToPlay' value='0'>\r\n" Madie+="<param name='InvokeURLs' value='1'>\r\n" Madie+="<param name='DefaultFrame' value='datawindow'>\r\n" Madie+="<embed src='"+url+"' width='440' autostart='true' height='380'>\r\n" Madie+="</embed>\r\n" Madie+="</object>\r\n" Real+="<object classid='clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA' name=player width='440' height='380'>\r\n" Real+="<param name='_ExtentX' value='4445'>\r\n" Real+="<param name='_ExtentY' value='3334'>\r\n" Real+="<param name='AUTOSTART' value='true'>\r\n" Real+="<param name='SHUFFLE' value='0'>\r\n" Real+="<param name='PREFETCH' value='0'>\r\n" Real+="<param name='NOLABELS' value='0'>\r\n" Real+="<param name='SRC' value='" Real+=url+"'>\r\n" Real+="<param name='CONTROLS' value='Imagewindow,StatusBar,ControlPanel'>\r\n" Real+="<param name='CONSOLE' value='clip1'>\r\n" Real+="<param name='LOOP' value='true'>\r\n" Real+="<param name='NUMLOOP' value='0'>\r\n" Real+="<param name='CENTER' value='0'>\r\n" Real+="<param name='MAINTAINASPECT' value='0'>\r\n" Real+="<param name='BACKGROUNDCOLOR' value='#000000'>\r\n" Real+="<embed src='"+url+"' width='440' autostart='true' height='380'>\r\n" Real+="</embed>\r\n" Real+="</object>\r\n" if(document.getElementById(id).innerHTML==''){ if (mode=='0'){ document.getElementById(id).innerHTML = Madie } if (mode=='1'){ document.getElementById(id).innerHTML = Real } }else{ document.getElementById(id).innerHTML=''; } } </script> <a href="javascript:" onclick="play('play1','http://www.davidroland.com/oldsite/music/mps3/midaircollision.MP3','0')">放个MTV(打开/隐藏)</a><br/> <div id="play1"></div><br/>