Random Background-image

liunx

Guest
I know how to make a random-image, but I have simply no idea how to make this work in the <BODY>. <br />
<br />
Can somebody give me a hint?<!--content-->Well, I Googled "Random Background Image" and clicked on the first link that came up. Which gave me this. (<!-- m --><a class="postlink" href="http://javascriptkit.com/script/cut176.shtml">http://javascriptkit.com/script/cut176.shtml</a><!-- m -->). That will change the background image every time you refresh the page.<!--content-->Several ways, but the most direct is probably to use the onload event to set document.body.background to an image.<!--content-->I would recommend using something along the lines of what TheBearMay has suggested, rather than the script in the link PaulJr has posted, as that using JavaScript to write in the <body> element - not a good idea.<!--content-->
 
Back
Top