解决IE需要激活 ActiveX 控件和生成控件调用代码

//AXObject.js代码
function AXObject(id,classid,tagName){
    this.tagName = (typeof tagName == 'string')?tagName:"object";
    this.params = new Object();
    this.variables = new Object();
    this.setVariable("id",id);
    this.setVariable("name",id);
    this.setVariable("classid",classid);
}
AXObject.prototype.setParam = function(key,value){
    this.params[key] = value;
}
AXObject.prototype.getParam = function(key){
    return this.params[key];
}
AXObject.prototype.getParams = function(){
    return this.params;
}
AXObject.prototype.setVariable = function(key,value){
    this.variables[key] = value;
}
AXObject.prototype.getVariable = function(key){
    return this.variables[key];
}
AXObject.prototype.getVariables = function(key){
    return this.variables;
}
AXObject.prototype.getHtml = function(){
    var con = '<'+this.tagName+' ';
    var variables = this.getVariables();
    for(var key in variables){
        con += key + '="' + variables[key] + '" ';
    }
    con += ' >';
    var params = this.getParams();
    for(var key in params){
        con += '<param name="'+ key +'" value="'+ params[key] +'" />';
    }
    con += '</'+this.tagName+'>';
    return con;
}
AXObject.prototype.write = function(elementId){
    if(typeof elementId == 'undefined'){
        document.write(this.getHtml());
    }else{
        var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
        n.innerHTML = this.getHtml();
    }
}

//调用实例;
<script language="javascript">
        var axo = new AXObject("mediaPlayerObject","clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6");
        axo.setVariable("width","400");
        axo.setVariable("height","300");
        axo.setParam("URL","http://bbmedia.qq.com/media/game/2006/06/20060626contra.wmv");
        axo.setParam("rate","1");
        axo.setParam("balance","0");
        axo.setParam("currentPosition","0");
        axo.setParam("playCount","1");
        axo.setParam("autoStart","0");
        axo.setParam("currentMarker","0");
        axo.setParam("invokeURLs","-1");
        axo.setParam("volume","0");
        axo.setParam("mute","0");
        axo.setParam("uiMode","full");
        axo.setParam("stretchToFit","-1");
        axo.setParam("windowlessVideo","0");
        axo.setParam("enabled","-1");
        axo.setParam("enableContextMenu","0");
        axo.setParam("fullScreen","0");
        axo.setParam("enableErrorDialogs","0");
        axo.write();
</script>
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值