可以使用javascript将ActiveX控件附加到页面?

编程入门 行业动态 更新时间:2024-10-07 12:25:21
本文介绍了可以使用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控件附加到页面?

本文发布于:2023-11-02 06:19:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551602.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以使用   控件   页面   ActiveX   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!