- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime_spent.html
More file actions
Latest commit
40 lines (35 loc) · 1 KB
/
Copy pathtime_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>
<htmllang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<metacharset="utf-8" />
<title>Time Spent</title>
<style>
body {
background-color:white;
}
</style>
<scripttype="text/javascript">
varseconds;
seconds=0;
//create the updateTime() function
functionupdateTime(){
seconds++;
soFar.innerHTML=seconds;
}
//create the startTimer() function
functionstartTimer(){
window.setInterval('updateTime()',1000);
}
functionchangeBG(){
varinputColor=window.prompt("please choose a color: ");
document.body.style.backgroundColor=inputColor;
}
</script>
</head>
<bodyonload="startTimer();changeBG()" >
<p>
Seconds you have spent viewing this page so far:
<aid="soFar" style="color:#f00; font-size:2em">0</a>
</p>
</body>
</html>