tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fzli...@omnytex.com
Subject Re: Reducing network traffic for rollover images
Date Fri, 01 Oct 2004 17:49:04 GMT
The problem is actually in your scripting... The browser should be caching the image after
the first view anyway, but the problem you are referring to is a result of not pre-loading
the images.  You do that by the following script when the page loads:

img0 = new Image();
img0.src = "normal_version.gif";
img1 = new Image();
img1.src = "mouseover_version.gif";

The for your mouseovers, you simply do:

onMouseover="this.src=img1.src;"

and for mouseout:

onMouseOut="this.src=img0.src;"

That way, when the page loads the images will be loaded into the img0 and img1 objects, and
the switching of the src for the displayed image is pointing to an image in memory at that
point.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, October 1, 2004 1:44 pm, Robert Hunt said:
> Is there a way (as in, response header or other HTTPServletResponse
> setting)
> that can persuade a
> browser to use a cached version of an GIF/JPG that's used for a rollover
> effect?
> I'd like to reduce the network traffic (and perhaps improve the browser's
> "response")
> from browsers that attempt to (re)load a rollover image for every tiny
> mousemove increment --
> only to receive a 304 response anyway.
> 
> 
> -- RH
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 


Mime
View raw message