如何让这个eval()调用在IE中工作?(How can I get this eval() call to work in IE?)

编程入门 行业动态 更新时间:2024-10-25 08:28:47
如何让这个eval()调用在IE中工作?(How can I get this eval() call to work in IE?)

我有一些javascript出来并在另一个xhtml页面上获取一个javascript“类”。 远程javascript看起来如下所示:

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

在获取到this.javascript后,我尝试评估它并实例化:

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

当然,这在IE以外的所有浏览器中都能很好地工作。 在IE中,它在评估线上失败。 有没有人有关于如何在IE或其他方面使这项工作的建议。

谢谢,皮特

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(); }; })

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();

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.

Thanks, Pete

最满意答案

你有没有尝试过:

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

...?

Have you tried:

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

...?

更多推荐

本文发布于:2023-08-06 15:43:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1451915.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作   eval   work   call

发布评论

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

>www.elefans.com

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