简体   繁体   English

使用查询小部件将ActiveX控件动态加载到页面上

[英]Loading ActiveX control dynamically onto page using query widget

I have an active X control that looks something like this: 我有一个活动的X控件,看起来像这样:

<object id="activeX" height="100%" width="100%" classid="myClass" >
    <param name="name" value="myControlName" />
    <param name="details" value="interestingDetails" />
    <param name="a" value="a" />
    <param name="b" value="b" />
</object>

Instead of having this html live on my page, I'd like to insert it dynamically using a jquery widget. 除了要在页面上显示此html之外,我还想使用jquery小部件动态地插入它。

I could do something like this: 我可以做这样的事情:

myObject.id = "activeX";
        myObject.height = "100%";
        myObject.width = "100%";
        myObject.classid = "myClass";


    var param1 = document.createElement('param');
    param1.setAttribute('name', 'name');
    param1.setAttribute('value', 'myControlName');
    myObject.appendChild(param1);

    var param2 = document.createElement('param');
    param2.setAttribute('name', 'details');
    param2.setAttribute('value', 'interestingDetails');
    myObject.appendChild(param2);

    var param3 = document.createElement('param');
    param3.setAttribute('name', 'a');
    param3.setAttribute('value', 'a');
    myObject.appendChild(param3);

    var param4 = document.createElement('param');
    param4.setAttribute('name', 'b');
    param4.setAttribute('value', 'b');
    myObject.appendChild(param4);

and then attach that object to something on my page. 然后将该对象附加到我的页面上。

Or i could simply append the html to my page like: 或者我可以简单地将html附加到我的页面上,例如:

 $('#div').append('<object id="activeX" height="100%" width="100%" classid="myClass" >')
    .append('<param name="name" value="myControlName" />')
    .append('<param name="details" value="interestingDetails" />')
    .append('<param name="a" value="a" />')
    .append('<param name="b" value="b" />')
    .append('</object>');

Niether of these work. 这些工作无足轻重。 When i try and call the active X control that I just loaded onto the page using either of the above 2 methods, I get object doesn't exist. 当我尝试使用上述两种方法之一调用刚刚加载到页面上的活动X控件时,我得到的对象不存在。

Calling the active X objects, when I write the straight the my HTML works. 调用活动的X对象,当我编写直线时,我的HTML就可以正常工作。 But not when I load this object from a widget. 但是,当我从窗口小部件加载此对象时却没有。

--Does anyone know a way to load activeX controls onto a page using jquery widgets? -有人知道使用jquery小部件将activeX控件加载到页面上的方法吗?

Thanks 谢谢

Check this: Possible to append a ActiveX control to a page using javascript? 请检查以下内容: 可以使用JavaScript将ActiveX控件附加到页面吗?

I don't know what activex you are using but I can suggest a common approach: 我不知道您使用的是什么Activex,但我可以建议一种常见的方法:

  • Let the activex load in the page. 让Activex载入页面。
  • Just keep it hidden 保持隐藏
  • If there is start/stop kind of control, use it on "div" hide/show 如果存在启动/停止控件,请在“ div”隐藏/显示中使用它

This way, you'll ensure user gets a choice to allow activex during page load and can get content while showing the div element 这样,您可以确保用户可以选择在页面加载期间允许使用Activex,并且可以在显示div元素时获取内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM