Basic HTML version of Foils prepared 23 June 1997

Foil 63 Timeout methods

From JavaScript Tutorial for Certificate Course UC Web applications Certificate -- Summer 97. by Geoffrey C. Fox, Tom Scavo

setTimeout Examples for Foil 63
1 JavaScript has a pair of timeout methods
2 // Call setTimeout and assign a handle:
3 yourID = setTimeout(exp, msecs);
4 // Abort process started by setTimeout:
5 clearTimeout(yourID);
6 setTimeout starts a timer that causes expression exp to be evaluated after a time interval of msecs milliseconds
7 These methods can be used to animate text or images, or make a display change after a given time interval
  • Also to start a daemon, which monitors what's going on!
8 Note setTimeout does not start a loop, just a single timing. Thus clearTimeout need not be called unless abnormal termination is required
9 If you want a loop, ensure exp restarts a new setTimeout

in Table To:


Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998