【发布时间】:2018-12-01 03:56:03
【问题描述】:
面对 IE 和 jquery 的问题。该代码可在所有其他浏览器中运行,但在 IE 中使用时会中断。相当简单的实现。但我是 javascript 新手。
console.log('hi ie');
jQuery(document).ready(function () {
setTimeout(function () {
jQuery(".controlApply").on("click", function (event) {
pollVisibility();
console.log('after poll');
});
}, 1000);
});
//This method checks is a specific div is shown. Dirty way to check if a report is being processed
function pollVisibility() {
console.log('poll');
if (microstrategy.bones.rwb_viewer.objectID == '7647F4F611E2B39B923E0080EF058C78') {
if (!jQuery('#divWaitBox').attr('style')) {
console.log('divWaitBox');
//wait did not appear
microstrategy.getViewerBone().commands.exec('refresh');
} else if (jQuery('#divWaitBox').attr('style').indexOf('hidden') != -1) {
console.log('hidden');
microstrategy.getViewerBone().commands.exec('refresh');
} else {
console.log('other');
setTimeout(pollVisibility, 800);
}
} else {}
}
console.log 永远不会被调用,但是 document.ready 似乎可以在 IE 中工作
文档类型
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
如果它错了,我不能改变它。这是 MicroStrategy BI 应用程序的扩展。
【问题讨论】:
-
愚蠢的问题,但是你有打开控制台吗?否则 console.log 将无法工作。确保在打开控制台后重新加载页面。
-
控制台没有错误?
-
你不是在怪癖模式,是吗?不要忘记您的
<!DOCTYPE html>。 -
是的,我在打开控制台进行测试。它在 js 文件的顶部记录了我的 'console.log('ieucks') 就好了......
-
@RocketHazmat:
.bind()未被弃用。只是建议使用.on()。
标签: javascript jquery internet-explorer internet-explorer-8