可以使用javascript将ActiveX控件附加到页面? [英] Possible to append a ActiveX control to a page using javascript?

查看:114
本文介绍了可以使用javascript将ActiveX控件附加到页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jQuery动态地将ActiveX控件附加到页面。追加是成功的;但是,控件在以这种方式完成时不会初始化。我相信当包含控件的页面已完成渲染时,IE会调用ActiveX控件的OnCreate方法。问题是在渲染完成之前,页面上不存在标记,因此永远不会调用OnCreate。

I'm trying to append an ActiveX control dynamically to a page using jQuery. The append is successful; however, the control doesn't initialize when it is done this way. I believe IE calls the OnCreate method of an ActiveX control when a page that contains a control has finished rendering. The problem is that the tag is not present on the page until after rendering is finished, so OnCreate is never called.

我不确定这是不是问题,它是只是一个猜测。有人对此有经验吗?是否可以强制IE在特定时间调用OnCreate?

I'm not sure if that's the problem, it's just a guess. Does anyone have experience with this? Is it possible to force IE to call OnCreate at a specific time?

如果标签位于html中,则控件正常工作。我唯一看到问题的时候是通过javascript将对象添加到页面中。

The control works fine if the tag is in the html. The only time I see problems is when I add the object to the page via javascript.

更新:我需要知道IE的用途遇到

Update: I need to know what IE does when it encounters an

<object>

渲染时页面上的

标记。控件在该上下文中工作正常,因此IE当时正在调用某些东西。我需要在将控件添加到页面后期渲染后手动调用它。

tag on the page at render time. The control works fine in that context, so IE is calling something at that time. I need to invoke that manually after I've added the control to the page post render.

谢谢,Pete

推荐答案

您可以使用新的ActiveXObject(ProgID)以完全跨平台不友好的方式实例化控件。 ProgID是appName.typeName形式的字符串。例如,

You can instantiate the control in a totally cross-platform-unfriendly manner using new ActiveXObject(ProgID). ProgID is a string of the form "appName.typeName". e.g.,

var excel;
excel = new ActiveXObject("Excel.Application");
...

该示例仅在您的机器上安装了excel时才有效。

The example will only work if excel is installed on your machine.

这篇关于可以使用javascript将ActiveX控件附加到页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆