-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
50 lines (30 loc) · 1.07 KB
/
script.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
46
47
48
function tiktok()
{
var now = new Date();
var h = now.getHours();
var m = now.getMinutes();
var s = now.getSeconds();
m = checkTime(m);
s = checkTime(s);
document.getElementById("clock").innerHTML = h + ":" + m + ":" + s;
setTimeout(tiktok,1000);
function checkTime(i)
{
if (i < 10) return "0" + i;
return i;
}
var name = "Veronica";
if (h <= 11)
{
var greet = "Good Morning" + " " + name + "." + " " + "Don't forget your coffee!";
}
if (h >= 12 && h <= 17)
{
var greet = "Good Afternoon" + " " + name + "." + " "+ "Time to lift heavy.";
}
if (h >= 18 && h <= 24)
{
var greet = "Good evening" + " " + name + "." + " " + "Sleep time is at 2200";
}
document.getElementById("greet").innerHTML = greet;
}