-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworkinprogress.txt
45 lines (33 loc) · 958 Bytes
/
workinprogress.txt
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
<!DOCTYPE html>
<html>
<body>
<script>
var startTime, endTime;
function start() {
startTime = new Date();
};
function end() {
endTime = new Date();
var timeDiff = endTime - startTime; //in ms
// strip the ms
timeDiff /= 1000;
// get seconds
var seconds = Math.round(timeDiff % 60);
document.secondsForm.secondsBox.value = seconds;
}
//Stamp current time as stop time, compute elapsed time difference and display in textbox
function EndTiming() {
startTime = new Date(); //stamp current time
timeDiff = (endTime- startTime) / 1000; //compute elapsed time
document.secondsForm.secondsBox.value = timeDiff ; //set elapsed time in display box
}
</script>
<button onclick="start()">Start</button>
<button onclick="end()">End</button>
<form name="secondsForm">
Elapsed time:
<input type="text" name="secondsBox" size="7">
seconds
</form>
</body>
</html>