Changing Background Images with Rollover & pre loading

wxdqz

New Member
OK, i have a div that onmouseover changes the background of the page. It ass works right except it doesn't use preloaded images. Instead it redownloads the images, which causes a white background for a second or two.

the code is like


back1 = new Image();
back1.src = "images/backgrounds/a.jpg";

back2 = new Image();
back2.src = "images/backgrounds/b.jpg";

<div onmouseover="document.body.background=back2.src" onmouseout="document.body.background=back1.src">#</div>

and it will work, but it re-downloads the images. Now if i just put the images in "images/a.jpg" it seems to work, but i don't want to do this. So i'm confused as to why it's not working using a second subdirectory.

I've run into a problem trying to preload an image from an absolute url also, such as "http://www/images/backgrounds/b.jpg" or "http://www/images/b.jpg"

I'm using the latest internet explorer, and i'm really confused about this. Thanks for any help you can offer
 
Back
Top