Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image preload and Netscape - Strange Problem

Status
Not open for further replies.

Sneets

Programmer
Mar 6, 2002
1
DE
Hi there,
I have created a preload-javascript for my website (tolkienkun.de) that is supposed to load the navbar-images for fast access at mouseover/mouseout. My problem right now is: The script seems to be working, but in Netscape, I have to leave the site and go back with the back-button ("reload page" does work as well) to get it to work. that means, when I access the site by typing and slide over the buttons, they always get re-loaded, no cache-use it seems. after reloading the whole page, the thingy works as it should(no rectangles when I hover the buttons).
So, status is: the script doesn't work fine when the whole page is loaded for the first time. but as soon as it's in the browser cache, and I reload it, everything's ok...
any ideas what I did wrong?
My jscript:
<script language=&quot;JavaScript&quot;>
<!--
image_n = new Array(6); image_m = new Array(6);
for(i=0;i<=6;i++)
{

image_m=new Image(); image_n=new Image();

}
image_m[0].src='images/home_mover.gif';
image_m[1].src='images/bio_mover.gif';
image_m[2].src='images/lit_mover.gif';
image_m[3].src='images/tvkino_mover.gif';
image_m[4].src='images/dl_mover.gif';
image_m[5].src='images/bilder_mover.gif';
image_m[6].src='images/siteinf_mover.gif';
image_n[0].src='images/home_normal.gif';
image_n[1].src='images/bio_normal.gif';
image_n[2].src='images/lit_normal.gif';
image_n[3].src='images/tvkino_normal.gif';
image_n[4].src='images/dl_normal.gif';
image_n[5].src='images/bilder_normal.gif';
image_n[6].src='images/siteinf_normal.gif';
function showN(n){document.images['n'+n].src = image_n[n].src;}
function showM(n){document.images['n'+n].src = image_m[n].src;}
-->
</script>

and thats how my mouseover-events look like:
<a href=&quot;main.html&quot; target=main onmouseover=&quot;showM(0);&quot; onmouseout=&quot;showN(0);&quot;>
<img src=&quot;images/home_normal.gif&quot; name=&quot;n0&quot; border=0></a><br>

Thanks alot!
 
I am not completely sure where your solution
goes wrong, but have you considered simply preloading
all images, somewhere on your page, by displaying them
with width=1 height=1 ?

You might see a small line of dots
somwhere, but you could always say
to people that that was just a trendy
design-thing.

Or.... why not load them in a frame with
size zero ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top