How To Rotate Banners – One Image A Day – 7 Days A Week

Monday, December 7, 2009, 1:53 AM | Leave Comment

Sometimes I take part in the discussion on a few forums, one of which is facilitated by the Web Host where I have parked my website and a couple of blogs. One participant wanted to know if it was possible to have a script that will display a different image on each of the seven days of the week. It should then repeat itself for the next week and so on. She said she has seven images with given hyperlinks and the target must be set to _blank.

I came up with the following JavaScript with some notes for clarification of what I have done. You can implement it on a blog as well as a website.

You can tweak it to your liking. Obviously you have to change the images and URL. Target is set to _blank for all URLs per user’s instructions. You can remove the document.writeln two statements if you want.

As you can see new date is picked up ONLY when the page is refreshed. Otherwise, you can bring it into the loop. However, that would be an overkill.

Because WordPress does not allow JavaScript source code in its post, I have done it in an external file on my website.

Rotating banner – one image a day – 7 days a week

Throw us a like at

Post a Comment on Content of the Article


This is not a billboard for your advertisement. Make comments on the content else your comments would be deleted promptly.

CommentLuv badge