IE 9 JavaScript 错误 c00c023f
我只在 IE9 上遇到这个错误:
SCRIPT575:由于错误 c00c023f,无法完成操作。
错误发生在这一行: if ((a.responseXML) && (a.readyState==4)) {
我无法弄清楚为什么会发生这种情况,而且它似乎非常有效在其他浏览器中也很好。
这是我的 JavaScript 代码:
var a = new XMLHttpRequest();
a.open("GET",'/cust/ajax/getresult.php?qk=nnf87&arg1='+pzid,true);
a.onreadystatechange = function () {
if ((a.responseXML) && (a.readyState==4)) {
var N = a.responseXML.getElementsByTagName('result')
sequence = N[0].firstChild.data;
var SEQ = sequence.split(",");
var num = SEQ.length;
var sum = 0;
for(var n=0;n<num;n++){sum = sum + (SEQ[n]*1);}
//document.getElementById("the_number_of").innerHTML = sum;
var date = new Date();
date.setTime(date.getTime()+(2*60*60*1000));
document.cookie='cpa_num='+sum+'; expires= '+date.toGMTString()+'; path=/';
}
}
I came across this error only on IE9:
SCRIPT575: Could not complete the operation due to error c00c023f.
The error happened on this line: if ((a.responseXML) && (a.readyState==4)) {
I cant figure it out why this happened, and it seems to work very well in other browsers.
and this is my javascript code:
var a = new XMLHttpRequest();
a.open("GET",'/cust/ajax/getresult.php?qk=nnf87&arg1='+pzid,true);
a.onreadystatechange = function () {
if ((a.responseXML) && (a.readyState==4)) {
var N = a.responseXML.getElementsByTagName('result')
sequence = N[0].firstChild.data;
var SEQ = sequence.split(",");
var num = SEQ.length;
var sum = 0;
for(var n=0;n<num;n++){sum = sum + (SEQ[n]*1);}
//document.getElementById("the_number_of").innerHTML = sum;
var date = new Date();
date.setTime(date.getTime()+(2*60*60*1000));
document.cookie='cpa_num='+sum+'; expires= '+date.toGMTString()+'; path=/';
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我不认为你的请求被中止了?快速谷歌搜索发现了这篇博客文章。当尝试从 XMLHttpRequest 对象读取任何属性时,IE9 中的中止请求似乎会出现此错误。
从帖子中可以看出,他们与此错误代码相关的特定问题可以通过以下方式重复:
作者通过在执行手动中止时为请求分配中止状态,并在尝试读取任何其他属性之前检测并返回来缓解此问题。尽管这种方法只有在您自己执行中止时才真正有效。
这篇 WebSync Google 网上论坛帖子。在讨论快要结束时,暗示这个问题只会发生
希望为您指明正确的方向。
I don't suppose your request is being aborted? A quick Googling found this blog post. It would seem that an aborted request in IE9 will give this error when trying to read any properties off of the XMLHttpRequest object.
From the post, their particular problem with this error code could be duplicated by:
The author mitigates this problem by assigning an abort state to the request when the manual-abort is performed, and detecting it and returning before trying to read any other properties. Though this approach would only really work if you are performing the abort yourself.
A similar problem was documented on the this WebSync Google Groups post. Towards the end of the discussion there is an implication that this problem only occurs
Hope that points you in the right direction.
在readyState==4例程中,包含一个类似于以下内容的try和catch:
我们发现这是对上述内容最成功的解决方案。
Within the readyState==4 routine, include a try and catch similar to:
We found that this to be the most successful resolution to the above.
将 切换
为
因为顺序很重要。似乎在 IE9 上,如果状态不是 4,responseXML 和 reponseText 在被访问时会产生此错误(我不知道为什么......)
Switch the
to
As the order matters. it seems that on IE9 if the state is not 4, the responseXML and reponseText yield this error if being accessed (I have no clue why...)
我在我的框架中收到此错误。它只显示在 IE 中(见图)。我简单地将响应包装如下:
I was getting this error in my Framework. It only shows up in IE (go figure). I simply wrapped the response like below:
当我过早地读取“status”属性时(在readyState为4/DONE之前),IE9会发生这种情况。
It happens for me with IE9 when I read the "status" property prematurely (before readyState is 4 / DONE).