I'm creating a javascript so that at certain times of the day, it changes the layout of the webpage. I also have it set up so that if the style has been manually changed it will change the style on each page.
When clicking on one of the buttons to manually change it and then go onto another page, the style is missing entirely. Can anyone help?
Here is my code
// JavaScript Document
var mode = 0;
function webload() {
if(mode == 0)
{
var d = new Date();
var n = d.getHours();
if (7 <= n && n < 18)
{
day();
}
else
{
night();
}
}
elif(mode == 1)
{
day();
}
elif(mode == 2)
{
night();
}
elif(mode == 3)
{
highcon()
}
}
function day() {
document.body.style.background = 'url(images/day_bg_top.png) top scroll no-repeat, url(images/day_bg_bot.png) bottom scroll repeat-x, #53a3ff';
document.getElementById('spacer').style.background = '#53a3ff';
document.getElementById('spacer2').style.background = '#53a3ff';
mode = 1
}
function night() {
document.body.style.background = 'url(images/night_bg_top.png) top scroll no-repeat, url(images/night_bg_bot.png) bottom scroll repeat-x, #000c36';
document.getElementById('spacer').style.background = '#000c36';
document.getElementById('spacer2').style.background = '#000c36';
mode = 2
}
function highcon() {
document.body.style.background = 'url(images/night_bg_top.png) top scroll no-repeat, url(images/night_bg_bot.png) bottom scroll repeat-x, #000c36';
document.getElementById('spacer').style.background = '#000c36';
document.getElementById('spacer2').style.background = '#000c36';
mode = 3
}