diff --git a/code/chrono.js b/code/chrono.js new file mode 100644 index 0000000..1ae0842 --- /dev/null +++ b/code/chrono.js @@ -0,0 +1,57 @@ +var startTime = 0 +var start = 0 +var end = 0 +var diff = 0 +var timerID = 0 +function chrono(){ + end = new Date() + diff = end - start + diff = new Date(diff) + var msec = diff.getMilliseconds() + var sec = diff.getSeconds() + var min = diff.getMinutes() + var hr = diff.getHours()-1 + if (min < 10){ + min = "0" + min + } + if (sec < 10){ + sec = "0" + sec + } + if(msec < 10){ + msec = "00" +msec + } + else if(msec < 100){ + msec = "0" +msec + } + document.getElementById("chronotime").innerHTML = hr + ":" + min + ":" + sec + ":" + msec + timerID = setTimeout("chrono()", 10) +} +function chronoStart(){ + document.chronoForm.startstop.value = "stop!" + document.chronoForm.startstop.onclick = chronoStop + document.chronoForm.reset.onclick = chronoReset + start = new Date() + chrono() +} +function chronoContinue(){ + document.chronoForm.startstop.value = "stop!" + document.chronoForm.startstop.onclick = chronoStop + document.chronoForm.reset.onclick = chronoReset + start = new Date()-diff + start = new Date(start) + chrono() +} +function chronoReset(){ + document.getElementById("chronotime").innerHTML = "0:00:00:000" + start = new Date() +} +function chronoStopReset(){ + document.getElementById("chronotime").innerHTML = "0:00:00:000" + document.chronoForm.startstop.onclick = chronoStart +} +function chronoStop(){ + document.chronoForm.startstop.value = "start!" + document.chronoForm.startstop.onclick = chronoContinue + document.chronoForm.reset.onclick = chronoStopReset + clearTimeout(timerID) +} \ No newline at end of file diff --git a/code/index.css b/code/index.css index 5439a0a..1a9c50f 100644 --- a/code/index.css +++ b/code/index.css @@ -1,7 +1,7 @@ .all-container { display : flex; - justify-content: space-between; + justify-content: space-evenly; /* align-items: baseline; width : min-content; diff --git a/code/index.html b/code/index.html index ad5ebd2..35112c7 100644 --- a/code/index.html +++ b/code/index.html @@ -8,12 +8,17 @@