无法完成,由于操作错误80020101. IE [复制]无法完成,由于操作错误80020101. I

2019-05-17 08:18发布

可能重复:
Ajax请求的问题:错误80020101

我使用jQuery的1.64,这是我的代码来复位定时器

var message="Logged in";
var myTimeout = setTimeout("timerDone()",1000 * 1440);
function timerDone()
{
    message="Logged out";   
}
function timerReset()
{


    clearTimeout(myTimeout);
    myTimeout = setTimeout("timerDone()", 1000 * 1440);
}

但它给了我一个错误,只能在IE中,当我试图做clearTimeout。 任何的想法????

Answer 1:

我不知道为什么,但它为我工作。 如果你有这样的评论

//Comment

然后,它给出了这样的错误。 为了解决这个问题做

/*Comment*/

没有任何意义,但它为我工作。



Answer 2:

所有的错误80020101点的意思是说有一个错误,某种形式的,而评估的JavaScript。 如果您通过Ajax加载JavaScript的,评价过程是特别严格。

有时删除//将解决这一问题,但相反是不正确的......这个问题并不总是由//引起的。

看看确切的JavaScript被你的Ajax调用返回,并寻找在该脚本的任何问题。 欲了解更多详细信息,在这里看到一个很大的书面记录

http://mattwhite.me/blog/2010/4/21/tracking-down-error-80020101-in-internet-exploder.html



Answer 3:

包装你的整个代码块在此:

//<![CDATA[

//code here

//]]>

也确保指定脚本的类型是text / JavaScript的

尝试,让我知道如何去



Answer 4:

如果您使用IE9关闭兼容性视图。



Answer 5:

当你叫timerReset()? 也许你想叫它后的setTimeout()已经做了的事情,当这个错误?

敷在

if (window.myTimeout) { 
  clearTimeout(myTimeout);
  myTimeout = setTimeout("timerDone()", 1000 * 1440);
}

编辑:其实,在进一步思考,因为你没有提到的jQuery(,但没有任何实际的jQuery代码在这里...我不知道,如果你有这样的嵌套一些jQuery的内部(如内部$(document).ready(.. 。这是变量的作用域的问题如果是的话,试试这个:

window.message="Logged in";
window.myTimeout = setTimeout("timerDone()",1000 * 1440);
function timerDone()
{
    window.message="Logged out";   
}
function timerReset()
{


    clearTimeout(window.myTimeout);
    window.myTimeout = setTimeout("timerDone()", 1000 * 1440);
}


文章来源: Could not complete the operation due to error 80020101. IE [duplicate]