首先在頁面加入avtivex
復制代碼 代碼如下:
<object classid="clsid:B094CE95-40EA-4798-99DC-4B8CE548121F" height="100%" width="100%" id="UiMonitor"> </object>
javascript 代碼
復制代碼 代碼如下:
<%--使用activex事件--%>
<script type="text/javascript" language="jscript" for="UiMonitor" event="CommMsg(videoID,uMsgCode,bsMsgBody)">
myfunction(videoID,uMsgCode,bsMsgBody);
</script>
<script language="javascript" type="text/javascript">
<%--activex事件的具體操作--%>
function myfunction(videoID, uMsgCode, bsMsgBody) {
alert(videoID);
}
function test()
{
//首先創建一個avtivex對象
var UiMonitor = document.getElementById("UiMonitor");
//獲取或設置activex屬性
UiMonitor.RunMode=“1”;
//調用activex方法
var videoID=UiMonitor.AddMonitor(deviceid, playAddr, 0);
}
</script>