Hello all,

I need to write a script that changes an image once a week on the same day every week (for instance, every sunday).

So far I have written code that changes the image on the correct day but it only shows the image on the Sunday (as that's the only thing I can figure out at the moment).

Any help would be HUGELY appreciated!

Thank you in advance.


This is what my current code looks like:

var d = new Date()

var date = d.getDate()

var dow = new Array('sunday','monday','tuesday','wednesday','thursday','friday','saturday');

var dayd = d.getDay();

var weekday = dow[dayd]

if (date >= 1 && date <= 8 && weekday == "sunday")

{

document.write("<IMG SRC='image1.jpg'>");

}

else if (date >= 9 && date <= 16 && weekday == "sunday")

{

document.write("<IMG SRC='image2.jpg'>");

}

else if (date >= 17 && date <= 24 && weekday == "sunday")

{

document.write("<IMG SRC='image3.jpg'>");

}

else

{

document.write("<IMG SRC='image4.jpg'>");

}