mercredi 25 mars 2020

With this Javascript code, my 'else if' statement isn't working. Does someone have any idea what the problem is?

if (hour >= 6 && hour < 12) {
    document.body.style.backgroundColor = "black";
    document.getElementById("moon").style.display = "none";
}
else if (hour >= 12 && hour < 18) {
    document.body.style.backgroundColor = "#68a4ff";
    document.getElementById("moon").style.display = "none";
}
else {
    document.body.style.backgroundColor = "#131862";
    document.getElementById("sun").style.display = "none";
}

Aucun commentaire:

Enregistrer un commentaire