so i want a background that changes each day. and ideally i wouldnt' be using an array for this.. and instead could just do something like... var d = new Date() document.write("<body background='"d.getMonth(),d.getDate()".jpg'>") with the images in the same directory being named 01.jpg for jan 1st, 031.jpg for jan 31st, etc. etc. but i know nothing about the syntax or structure that that would require. i think my non-working example should at least explain what i want to accomplish... can someone tell me how i can do this? i know it's possible... i've seen every element i need in other scripts, but i just don't know how to make them all work together without getting a bunch of errors... p.s. this is actually on my windows desktop, not a website. it seems like some scripts won't work in an html set as the desktop background, but will on a webpage.. so thats weird too...
Not sure if this helps, but maybe you need to set the full path to the images like: C:\folder\01.jpg ???
You need to attach the background to the existing BODY tag. If you use JavaScript in the manner you are suggesting, you'll be creating TWO body tags, which can really screw up the DOM, among other things. And I don't know about you, but I'd rather do this on the server-side, creating a custom stylesheet that would be dynamically generated at run time to place the background image on the body. Though this does have the draw-back of using the server's own clock rather than the user's (which is accessed through JavaScript's date object).