View Full Version : rollover menus don't preload

01-04-2007, 09:53 AM
I have a bunch of menu buttons that rollover properly and javascript preloading that I THOUGHT used to work but isn't now. It's flickering and reloading the images each time the mouse is moved over top and off, even on the same button. I thought they worked perfectly in the past, but with no changes they're not working today.
Here's the simplified code

<style type="text/css">
#imagetabred a:hover, #imagetabred a.current{ /*change background when over red tabs*/
color: #330000;

<SCRIPT language="JavaScript">
if (document.images)
preload_image_object = new Image();
// set image url
image_url = new Array();
image_url[0] = "http://yaddayadda/BMenuTabRed.jpg";
image_url[1] = "http://yaddayadda/BMenuTabRedOver.jpg";

// creating image objects using above URLs
var preloadedImages = new Array();
var i
for(i=0; i<=image_url.length; i++){
preloadedImages[i] = new Image();
preloadedImages[i].src = image_url[i];
<div >
<span id="imagetabred"><a href="http://yaddayadda/link.htm" target="_blank">BUTTON</a> </span>

I know about putting the 2 images together in 1 file can be an alternate to this, but I have a lot of images and redoing everything isn't possible at this stage. If anyone sees a flaw with the above code, please point it out.

01-08-2007, 09:28 AM
There is nothing wrong with your code that I can see. Then again it is 3:30am. I do know that a lot of browsers handle this situation different. If you where using the actual javascript image objects to display the images then it would not reload. But if you are using CSS in IE the images to refresh as it makes a hit back to the server without checking to see if it is in the cache. I do not know why this happens I just know that in certain circumstances it does happen.

01-15-2007, 08:00 PM
oh oh! how do i use javascript to display them? I was wondering about that but I'm new to javascript. please please reply


02-07-2007, 01:41 AM
can i get a bump?