hallo,
I have this code into a js file, it is loaded when I open a webpage. The purpose of the code is to show a different background image each day, looping through the available pictures. The problem is that the last line of the code doesn't seem to work and since I'm not an expert of js I don't know why... any idea?
I have this code into a js file, it is loaded when I open a webpage. The purpose of the code is to show a different background image each day, looping through the available pictures. The problem is that the last line of the code doesn't seem to work and since I'm not an expert of js I don't know why... any idea?
Code:
window.onload = function() {
var today = new Date();
var first = new Date(today.getFullYear(),0,1);
var theDay = Math.round(((today-first)/1000/60/60/24)+.5,0);
var picNr = 10;
var picUse;
picUse = theDay%picNr;
document.getElementById('Top').style.background='url(../img/'+this.picUse+'.jpg)';
}