我的主页面加载jquery-1.7.2.min.js
和jquery-ui-1.8.18.custom.min.js
跟随jquery-ui-1.8.18.custom.css
。在我的主页面中,我在$('#main_tabs').tabs();
内设置$(function($){ });
使用了jQuery UI Tab,并使用iFrame加载另一个页面。
$(function($){
// Tabs
$('#main_tabs').tabs();
});
将加载到iFrame的页面中,该页面托管在同一目录中,jquery-1.5.min.js
和第三方javaScript库(称为timeline.js
)已加载。 timeline.js中的javaScript代码以某种方式使用jquery-1.5.min.js
(必须在此第三方库之前加载),因此页面将按原样运行。
timeline.js中的一些脚本示例
// javaScritp Class defined here
$(document).ready(function() {
$.browser.isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
$.browser.isMac = navigator.userAgent.toLowerCase().indexOf('macintosh') > -1;
if ($.browser.msie && $.browser.version >= 9) {
$.browser.msie = false;
$.browser.isIE9 = true;
}
theAJKWindowResizeEvent = new AJKWindowResizeEvent().init();
theAJKMouseMoveEvent = new AJKMouseMoveEvent().init();
theAJKMouseScrollEvent = new AJKMouseScrollEvent(
…. //more code
});
当加载主页面时(在启用了firebug的Firefox上)存在错误,这些错误让我对iFrame感到困惑。
有些错误显示如下(不在订单中,每次尝试重新加载时订单都会更改)
A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
Script: http://localhost/TMCH/js/jquery/jquery-1.5.min.js:16
A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
Script: http://localhost/TMCH/js/jquery/ jquery-1.7.2.min.js:2
A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
Script: http://localhost/TMCH/js/timeline.js?version=6.035:5532
我尝试调试这些错误,并发现如果我对$('#main_tabs').tabs();
发表评论(避免使用jQuery UI),则没有错误。 iFrame中的页面加载得很好,但是由于没有调用UI,我的主页看起来很丑陋而且非常混乱。
有谁能解释为什么会发生这件事?非常感谢任何解决方案