File tree Expand file tree Collapse file tree 3 files changed +31
-5
lines changed
Expand file tree Collapse file tree 3 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,19 @@ let changeBgColor = false;
55function setAlarm ( ) {
66 inputTime = Number ( document . querySelector ( "#alarmSet" ) . value ) ;
77
8- if ( Number . isInteger ( inputTime ) && ! isNaN ( inputTime ) && inputTime >= 0 ) {
8+ if ( Number . isInteger ( inputTime ) && inputTime >= 0 ) {
99 if ( inputTime === 10 ) {
1010 changeBgColor = true ;
1111 } else if ( inputTime === 0 ) {
1212 displayTime ( inputTime ) ;
1313 playAlarm ( ) ;
14+ document . querySelector ( "#alarmSet" ) . value = "" ;
1415 }
1516 displayTime ( inputTime ) ;
16- if ( timer ) clearInterval ( timer ) ;
17+ if ( timer ) {
18+ clearInterval ( timer ) ;
19+ timer = null ;
20+ }
1721 timer = setInterval ( countDown , 1000 ) ;
1822 }
1923}
Original file line number Diff line number Diff line change 88 </ head >
99 < body >
1010 < div class ="centre ">
11- < h1 id ="timeRemaining "> Time Remaining: 00:00</ h1 >
11+ < div id ="timeRemaining ">
12+ Time Remaining: < span id ="theTime "> 00:00</ span >
13+ </ div >
1214 < label for ="alarmSet "> Set time to:</ label >
1315 < input id ="alarmSet " type ="number " />
1416
Original file line number Diff line number Diff line change 1010 background-color : # f0f8ff ;
1111}
1212
13- # alarmSet {
13+ # theTime {
14+ font-size : 24px ;
15+ text-align : center;
1416 margin : 20px ;
1517}
1618
17- h1 {
19+ # timeRemaining {
20+ font-size : 24px ;
1821 text-align : center;
22+ margin : 20px ;
23+ }
24+
25+ # alarmSet {
26+ margin : 20px ;
27+ font-size : 18px ;
28+ text-align : center;
29+ }
30+ # set {
31+ font-size : 14px ;
32+ padding : 5px ;
33+ }
34+
35+ # stop {
36+ font-size : 14px ;
37+ padding : 5px ;
38+ margin-left : 20px ;
1939}
You can’t perform that action at this time.
0 commit comments