HELP! * GREY=local LOCAL HTML version of Foils prepared 15 January 1997

Foil 61 setTimeOut Example -- Display Current Time - I

From JavaScript Tutorial for CPS616 Technologies of the Information Age 1997 Basic Information Track of CPS -- Spring Semester 97. by Geoffrey C. Fox * Important Information in IMAGE

<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 Wed Feb 19 1997