/*This program will display time. User may stop and continue time*/ //user current local time is set and continue var myVar = setInterval(function(){ myTimer() }, 1000); //this function will restart time while updating to the current time function startTime() { //user current local time is set and continue myVar = setInterval(function(){ myTimer() }, 1000); } //this function will display time on to the page function myTimer() { var d = new Date(); //getting date var t = d.toLocaleTimeString(); //geting the current local time document.getElementById("currentTime").innerHTML = t;//connect innerHTML to page } //this function will stop time completely function myStopFunction() { clearInterval(myVar);//stopping time }