PDA

View Full Version : cancel setTimeout


jolietjake
01-02-2003, 08:48 AM
Hello! here's a problem

I have a function that recalls himself with a setTimeout function, and want to cancel the setTimeout when the user press a button.

I know a method using global flags, but I want to know if is there any function that cancels the timeout automatically

Thanks

Jolietjake

glenngv
01-02-2003, 09:44 AM
t = setTimeout("functionName()",1000);

to cancel:
if (t) clearTimeout(t);