-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
33 lines (24 loc) · 788 Bytes
/
script.js
File metadata and controls
33 lines (24 loc) · 788 Bytes
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
function load() {
var msg = window.document.getElementById('mensagem');
var img = window.document.getElementById('imagem');
var data = new Date();
var hora = data.getHours()
var minuto = data.getMinutes()
msg.innerHTML = `Agora são ${hora}:${minuto} horas.`
if (hora >= 0 && hora < 12){
//Bom dia!
img.src = 'fotomanha.png'
document.body.style.background = '#e0ac33'
}else if (hora >= 12 && hora <18) {
//Boa tarde!
img.src = 'fototarde.png'
document.body.style.background = '#bc4a02'
}else {
//Boa noite!
img.src = 'fotonoite.png'
document.body.style.background = '#032e53'
}
setTimeout(function() {
document.location.reload(true);
} , 20000)
}