...

View Full Version : clearTimeout() and clearInterval()



Skyzyx
04-10-2003, 10:27 PM
I'm looking at some documentation for clearTimeout(). I'm seeing this example:

clearTimeout( timeoutIDnumber );

Apparently, I'm supposed to reference some type of ID for the setTimeout, but I'm not sure how to go about that.

Any help?

DoubleV
04-10-2003, 10:48 PM
var t = setTimeout ("your_function", timer);

clearTimeout(t);

cheesebagpipe
04-10-2003, 10:52 PM
Doesn't look like core timer documentation, but some api ('class' lib?). Return timers to a persistent property (could be global var) for later clearing:

var animTimerID = null;

function anim() {
.......
if (animTimerID == null)
animTimerID = setInterval(.......);
}

function stop_anim() {
if (animTimerID != null) {
clearInterval(animTimerID);
animTimerID = null;
}
}

Skyzyx
04-10-2003, 11:23 PM
Aaahh! That makes sense. Kinda like with new windows.



var win=window.open(...);

win.close();


Thanks guys! Big help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum