求助 JS clearTimeout 无效
function update(url,odj){
var ajax = ((typeof XMLHttpRequest == 'function') ? new XMLHttpReuest() : new ActiveXObject('Microsoft.XMLHTTP'));
ajax.open('get',url,true);
ajax.onreadystatechange = function(){
var flag = false,time;
if(ajax.readyState == 4 && ajax.status == 200){
if(ajax.responseText != null){
flag = true;
clearTimeout(time);
$('Progress').style.display = 'none';
$('Progress').style.backgroundColor = '';
}
}else{
(function(){
$('Progress').style.display = 'block';
with($('Progress').firstChild.style){
if(parseInt(marginRight) > 0){
marginRight = parseInt(marginRight) - 1;
}else{
$('Progress').style.backgroundColor = backgroundColor;
marginRight = 125;
backgroundColor = backgroundColor == '#fff' ? '#600' : '#fff';
}
}
time = setTimeout(arguments.callee,10);
})();
}
}
ajax.send(null);
}无法结束setTimeout 求各位大神看看那里的问题
...全文
相关推荐
JavaScript计时器用法分析【setTimeout和clearTimeout】
JavaScript的计时器操作技巧不仅仅是setTimeout和clearTimeout的使用,还包括其他相关的内容。
js 系统时间实时显示,清除clearTimeout
在JavaScript编程中,实时显示系统时间并清除定时器是一个常见的需求。这通常涉及到JavaScript的Date对象和setTimeout/clearTimeout函数的使用。
ClearTimeout消除闪动实例代码
"消除闪动实例代码 - clearTimeout方法用于取消setTimeout设置的定时器"在JavaScript编程中,`clearTimeout()`函数是一个非常重要的工具,它允许开发者取
js中setTimeout()与clearTimeout()用法实例浅析
== "") { // 当用户点击停止按钮时,使用clearTimeout()取消定时器 clearTimeout(iTime); }}aa();// 注意:在实际应用中,为了更好的代码管理和维护,建议使用匿名函数替代
js中setTimeout()与clearTimeout()用法实例浅析.docx
javascriptvar timeoutId = setTimeout(function() { console.log('This will not be printed.');}, 3000);// 取消定时器clearTimeout


