从javascript运行Activex时出错 [英] Error While running activex from javascript

查看:63
本文介绍了从javascript运行Activex时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我已经在asp.net中创建了Activex页面
并通过javascript
从网页调用它
这是我调用它的代码:

hi all
i have created activex page in asp.net
and calling it from web page through javascript

this my code for calling it:

<head> <title>C# ActiveX Test</title> </head>


<body onload="myload();">
<h1>This is Our ActiveX Test Page</ h1>

The message from the ActiveX Control is
<div id="axmsg"></div>


<script type ="text/javascript">
    function myload() {
        var myAx = new ActiveXObject("ClassLibraryFinger");
        if(myAx != null) {
            myAx.ShowDialog("hello from asp.net");
            var d = document.getElementById("axmsg");

            var s = myAx.Hello();
            d.outerText = s;
        }
        else
            alert("NOOOO... we failed");
    }
</script>
</body>



当我运行此项目时,出现以下错误:



when i m running this project i m getting error as:

Microsoft JScript runtime error: Automation server can''t create object



我已经用regasm注册了我的活动x dll
我已将其添加到Web应用程序
但它不起作用
谢谢
上帝保佑你们所有人:)



i have registered my active x dll with regasm
i have added it to web application
but it is not working
thank you
god bless u all :)

推荐答案



发生此错误是因为您的代码正试图执行一些冒险的任务,因此浏览器阻止了您.

所以你可以试试这个

打开IE>工具>互联网选项>安全>自定义级别> (启用Active X)
Hi,

This error happen because your code is try to perform some risky task, so browser blocking you.

So you can try this

Open IE > Tools > Internet Options > Security > Custom Level > (Enable Active X )


我已经尝试过了..

Open IE >> Tools >> Internet Options >> Security >> Custom Level >>(Enable) Initialize and script ActiveX controls not marked as safe for scripting


Javascript Javascript 肯定会运行.


谢谢
Ashish

如果这是您的答案,请将其标记为解决方案.
I had tried this..

Open IE >> Tools >> Internet Options >> Security >> Custom Level >>(Enable) Initialize and script ActiveX controls not marked as safe for scripting


You Javascript for ActiveX will surely run.


Thanks
Ashish

Mark it solution if this is your answer..


嗨..
我解决了
注册dll后,以下路径中不存在
C:\ Program Files \ Microsoft Visual Studio 9.0 \ Common7 \ IDE
所以我将其复制粘贴


hi..
i solved it
After registering dll it was not present on the following path
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
so i copy-paste it
and

<script type ="text/javascript">
    function myload() {
        var myAx = new ActiveXObject("ClassLibraryFinger.Class1");
        if(myAx != null) {
            myAx.ShowDialog("hello from asp.net");
            var d = document.getElementById("axmsg");

            var s = myAx.Hello();
            d.outerText = s;
        }
        else
            alert("NOOOO... we failed");
    }
</script>




在Activex对象中的dll名称之后添加了我的类名称
谢谢...:)




added my class name after the dll name in activex object
Thank you...:)


这篇关于从javascript运行Activex时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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