-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
45 lines (39 loc) · 924 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var minutes = 0;
var seconds = 0;
var mseconds = 0;
var minheader = document.getElementById("min");
var secheader = document.getElementById("sec");
var millisecheader = document.getElementById("msec");
var interval;
function Counter(){
mseconds++;
millisecheader.innerHTML = mseconds;
if(mseconds >= 100){
seconds++;
secheader.innerHTML = seconds;
mseconds = 0;
}
else if(seconds >= 60){
minutes++;
minheader.innerHTML = minutes;
seconds = 0;
}
}
function start(){
interval = setInterval(Counter , 10)
}
function pause(){
clearInterval(interval)
}
function reset(){
minutes = 0;
seconds = 0;
mseconds = 0;
millisecheader.innerHTML = mseconds;
secheader.innerHTML = seconds;
minheader.innerHTML = minutes;
clearInterval(interval)
}
function startBtnEnable(){
document.getElementById("start").disabled = false;
}