MediaPlayer网页播放器,照抄网上的代码报错?
<html>
<title>Untitled Page</title>
<script language="javascript">
function openPlay2(strURL, iloop) {
document.player.playCount = 2;
document.player.filename = "mp3/01.mp3";
document.player.controls.play();
}
</script>
</head>
<body>
<form>
<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
type="application/x-oleobject" height="200" width="300" id="player">
<param name="filename" value="" />
<param name="autostart" value="false" />
<param name="showstatusbar" value="true" />
<param name="showtracker" value="true" />
<param name="showcontrols" value="true" />
</object>
<input type="button" value="W" onclick="openPlay2('mp3/Err',2);" />
</form>
</body>
</html>
错误:'ducument.player.controls' is null or not an object
------解决方案--------------------应该是:classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
这个地方有问题,一般情况下,这个classid不好用。
还有就是,'ducument.player.controls' is null or not an object
这个方法不好,也可能是这个原因导致的,
你改成document.getElementById("player").controls试试。