如何获得此eval()调用以在IE中工作? [英] How can I get this eval() call to work in IE?

查看:146
本文介绍了如何获得此eval()调用以在IE中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些JavaScript可以退出,并在另一个xhtml页面上获取javascript类".远程javascript如下所示:

I have some javascript that goes out and fetches a javascript "class" on another xhtml page. The remote javascript looks something like the following:

    (function() {
        this.init = function() {
            jQuery("#__BALLOONS__tabs").tabs();
        };
    })

将其提取到this.javascript中之后,我尝试对其进行评估并实例化:

After this is fetched into this.javascript, I try to eval it and instantiate:

   this.javascript = eval("(" + this.javascript + ")");
   this.javascript = new this.javascript();
   this.javascript.init();

当然,这在除IE之外的所有浏览器中均能完美运行.在IE中,它在评估行失败.有人对我如何在IE或替代方法中实现这项工作有建议吗?

Of course, this works perfectly in all browsers except IE. In IE, it fails at the eval line. Does anyone have suggestions on how I can make this work in IE or an alternative.

谢谢,皮特

推荐答案

您是否尝试过:

eval("this.javascript = (" + this.javascript + ")");

...?

这篇关于如何获得此eval()调用以在IE中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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