Dynamic Background Image Depending on Time of Day
Basically I have a function that in my mind checks the time and if it is between 5am and 6pm will display a daytime background or a night time background if outside of those hours. There is a second set of amendments in the loop just to validate via text what should be outputted, but neither is.... scratching my head now, as I don't understand why it just doesn't work.
No errors according to my IDE, it just doesnt load a background, does that mean I'm stuck in limbo?
Here's my code:
Thanks in advance for any help you can give.
// Dynamic Background for HTML5 template based on time of day.
var d = new Date();
var h = d.getHours();
if ((h <= 5) && (h >=18))
document.getElementById("bgText").innerHTML="The BG Should be Day Time";
document.getElementById("bgText").innerHTML="The BG Should be Night Time";
window.onload = dynamicBG();