Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/414.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript setInterval中断要显示的页面_Javascript_Jquery_Internet Explorer - Fatal编程技术网

Javascript setInterval中断要显示的页面

Javascript setInterval中断要显示的页面,javascript,jquery,internet-explorer,Javascript,Jquery,Internet Explorer,我有一行代码: var checkExist5 = setInterval(function() { if (lock == 5 && $("#id1").length && $("#id2").length) { console.log("debug"); clearInterval(checkExist5); lock = -1; } }, 100);

我有一行代码:

var checkExist5 = setInterval(function() {
    if (lock == 5 && $("#id1").length && $("#id2").length) {            
        console.log("debug");
        clearInterval(checkExist5);           
        lock = -1;
    }
}, 100);

它可以在Firefox上运行,但在InternetExplorer上却会破坏页面。它在控制台上没有给出任何错误,但页面没有显示(ie 9)。原因可能是什么?

我找到了原因。是因为

console.log(“调试”)


它在Internet Explorer 9上不工作。这里有一个解释:

该代码没有问题。开发工具的控制台在运行时是否打开?您确定这段代码是罪魁祸首吗?插入警报或调试器语句以查看它们是否被命中?我已经尝试过这两种方法,它是否打开。它是否与我应该做的事情有关:`down vote accepted Try用ajaxSetup$.ajaxSetup({//Disable caching of AJAX responses*/cache:false})禁用缓存;`?Ajax与您提供的snipplet代码有什么关系?