如何让这个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 + ")");...?
更多推荐
发布评论