I need bit of help
So far I have this in between the head tags
And the below in between my body tags
This function automatically changes the page's background color each day of the week.
Author: Sean McManus
Author URL: http://www.sean.co.uk/
Usage: SM_dailyBgColor ("januarycolor", "februarycolor", "marchcolor", "aprilcolor", "maycolor", "junecolor", "julycolor", "augustcolor", "septembercolor", "octobercolor", "novembercolor", "decembercolor");
Can some please help me and point me in the right direction to get it to work
<body onLoad='SM_dailybg("images/1.jpg", "images/background.png", "images/1.jpg", "images/background.png", "images/1.jpg", "images/background.png", "images/1.jpg","images/background.png","images/1.jpg","images/background.png","images/1.jpg","images/background.png");'
To start off, why an object, and instead, an array? After all, that's what you basically are doing.
Second, for bgColor you're sending a string, which it converts to a color. If that's what you want, that's well and fine.
Finally, for your image thing, to make your image background work, you need to add "url("+...+")" to your document.body.style.background attribute, since in CSS, for a background IMAGE, you need to have it like 'url(place.com/image.jpg)' for it to work.
In essence, like this:
Hope that helps.
P.S. your title is not very descriptive. I believe in the rules it asks to have a more descriptitve title like "Cannot set background image with JS"
Here is a as simple as powerful solution for your monthly background images.
monthly = "january.jpg,february.jpg, . . . ,december.jpg".split(",");
background = new Date().getMonth();
document.body.background = monthly[background];
//clear used objects...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)