From f6546813c276584f170dc9a12c089864d98c2de5 Mon Sep 17 00:00:00 2001 From: murphypicard Date: Sun, 27 Nov 2016 17:01:33 -0500 Subject: [PATCH 1/3] timer HW start and pause work --- index.html | 8 +++++--- timers.js | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index c1129f7..cf2e92a 100644 --- a/index.html +++ b/index.html @@ -10,11 +10,13 @@

Stop Watch

- - - + + +
+ + diff --git a/timers.js b/timers.js index fd40910..642973e 100644 --- a/timers.js +++ b/timers.js @@ -1,4 +1,28 @@ +let reset = document.getElementById('reset'); +let start = document.getElementById('start'); +let pause = document.getElementById('pause'); +let seconds = 0; +let timerId; +function updateTime(){ + document.getElementsByTagName('h1')[0].innerHTML=seconds; + seconds++;} + +start.addEventListener('click', function() { + startCount = setInterval(updateTime, 1000); +}); + + +pause.addEventListener('click', function() { + clearInterval(startCount); +}); + + +reset.addEventListener('click', function(){ + + seconds = 0; + clearInterval(startCount); +}); From 2c77d8845b7f07b9521fc7e31b9774595a76a7ab Mon Sep 17 00:00:00 2001 From: murphypicard Date: Sun, 27 Nov 2016 17:17:12 -0500 Subject: [PATCH 2/3] timer week3 day1 Ara reset works too --- index.html | 2 +- style.css | 1 - timers.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index cf2e92a..4ab73ca 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@

Stop Watch

- +
diff --git a/style.css b/style.css index 6ddb643..f25cefb 100644 --- a/style.css +++ b/style.css @@ -27,4 +27,3 @@ button { button:hover{ background: #356094; } - diff --git a/timers.js b/timers.js index 642973e..13f4088 100644 --- a/timers.js +++ b/timers.js @@ -22,7 +22,7 @@ pause.addEventListener('click', function() { reset.addEventListener('click', function(){ - seconds = 0; clearInterval(startCount); + document.getElementsByTagName('h1')[0].innerHTML=seconds; }); From 48e9611e22b44e01daf9c63adb6b31abd4b9fd7c Mon Sep 17 00:00:00 2001 From: murphypicard Date: Sun, 27 Nov 2016 17:21:12 -0500 Subject: [PATCH 3/3] Ara MurphyPicard week3 day1 Timer --- timers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timers.js b/timers.js index 13f4088..b27f3b2 100644 --- a/timers.js +++ b/timers.js @@ -24,5 +24,5 @@ pause.addEventListener('click', function() { reset.addEventListener('click', function(){ seconds = 0; clearInterval(startCount); - document.getElementsByTagName('h1')[0].innerHTML=seconds; + document.getElementsByTagName('h1')[0].innerHTML= "Stop Watch"; });