HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 21 February 97

Foil 67 setTimeOut Example -- Display Current Time - I

From Feb 17/19 Delivered Lecture for Course CPS616 -- aJavaScript Language Objects and Frames CPS616 spring 1997 -- Feb 17 and 19 1997. by Geoffrey Fox * Important Information in IMAGE
Secs 93.6
<SCRIPT>
var timerID = null; // will be returned by call to setTimeout
var timerrunning = false;
function stopclock() { // terminate timeout
  • if( timerrunning )
    • clearTimeout(timerID);
  • timerrunning = false; }
function startclock()
{ // terminate timeout, display time, start timeout
  • stopclock();showtime(); }
function showtime()
{ // display time, start timeout
  • // Calculate current time in timeValue
  • document.clock.face.value = timeValue;
  • timerID = setTimeout("showtime()",1000); // Update every second
  • timerrunning = true; }
</SCRIPT>


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 Fri Feb 21 1997