0

I am using following code in my HTML page but it is returning NULL. (IE8 , MS WIndows 7 Pro)

Set Sound = CreateObject("WMPlayer.OCX")

I am sure Windows Media Player is installed and working fine.

How to fix it?

4

1 回答 1

0

似乎不可能像我在 HTML 中使用的那样使用 Visual Basic 代码。

取而代之的是,我们必须像这样在 DOM 中使用 Windows Media Player

<body onload='' scroll="no">
    <object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="WindowsMediaPlayer"
        width="0" height="0">
    </object>

稍后我们必须实现所有方法来启动/停止音频/电影。

例如

 <script type="text/vbscript" language="VBScript">       
     Set oElm = document.getElementById("WindowsMediaPlayer")
                if oElm Is Nothing then
                    ' MsgBox("element does not exist")
                else
                    ' MsgBox("element exists")
                    ' MsgBox oElm
                    oElm.controls.stop()
                    oElm.URL = "C:\HTML\Sounds\oos.wav"
                end if  
<script>  
于 2015-11-24T19:08:55.307 回答