-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime_spent.html
More file actions
40 lines (35 loc) · 1 KB
/
time_spent.html
File metadata and controls
40 lines (35 loc) · 1 KB
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
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Time Spent</title>
<style>
body {
background-color:white;
}
</style>
<script type="text/javascript">
var seconds;
seconds = 0;
//create the updateTime() function
function updateTime() {
seconds++;
soFar.innerHTML = seconds;
}
//create the startTimer() function
function startTimer() {
window.setInterval('updateTime()', 1000);
}
function changeBG() {
var inputColor = window.prompt("please choose a color: ");
document.body.style.backgroundColor = inputColor;
}
</script>
</head>
<body onload="startTimer();changeBG()" >
<p>
Seconds you have spent viewing this page so far:
<a id="soFar" style="color:#f00; font-size:2em">0</a>
</p>
</body>
</html>