网页播放器控制,兼容IE、 FF
<HTML>
<BODY >
<SCRIPT type="text/javascript">
document.write('<OBJECT id="Player"');
if(-1 != navigator.userAgent.indexOf("MSIE"))
{
document.write(' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"');
}
else if(-1 != navigator.userAgent.indexOf("Firefox"))
{
document.write(' type="application/x-ms-wmp"');
}
document.write(' width=300 height=200>');
document.write('<PARAM name="autoStart" value="true"/>');
document.write('<PARAM name="url" value=".wma文件路径"/>');
document.write('</OBJECT>');
</SCRIPT>
<input type= "button" id= "btn4 " value= "Play" onclick="playMusic()"/>
<input type= "button" id= "btn4 " value= "Stop" onclick="stopMusic()"/>
<SCRIPT>
function playMusic(){
document.getElementById("Player").controls.play();
}
function stopMusic(){
document.getElementById("Player").controls.stop();
}
</SCRIPT>
</BODY>
</HTML>
<BODY >
<SCRIPT type="text/javascript">
document.write('<OBJECT id="Player"');
if(-1 != navigator.userAgent.indexOf("MSIE"))
{
document.write(' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"');
}
else if(-1 != navigator.userAgent.indexOf("Firefox"))
{
document.write(' type="application/x-ms-wmp"');
}
document.write(' width=300 height=200>');
document.write('<PARAM name="autoStart" value="true"/>');
document.write('<PARAM name="url" value=".wma文件路径"/>');
document.write('</OBJECT>');
</SCRIPT>
<input type= "button" id= "btn4 " value= "Play" onclick="playMusic()"/>
<input type= "button" id= "btn4 " value= "Stop" onclick="stopMusic()"/>
<SCRIPT>
function playMusic(){
document.getElementById("Player").controls.play();
}
function stopMusic(){
document.getElementById("Player").controls.stop();
}
</SCRIPT>
</BODY>
</HTML>