There is, however due to some bugs in IE5 and Ie5.5 - it is not always
reliable - see MSDN - Q269802.

// Image Functions
// changeImage() and preload() functions for rollovers and GIF animation
// 19990326

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynduo/

function preload(imgObj,imgSrc) {
        if (document.images) {
                eval(imgObj+' = new Image()')
                eval(imgObj+'.src = "'+imgSrc+'"')
        }
}
function changeImage(layer,imgName,imgObj) {
        if (document.images) {
                if (document.layers && layer!=null)
eval('document.'+layer+'.document.images["'+imgName+'"].src =
'+imgObj+'.src')
                else document.images[imgName].src = eval(imgObj+".src")
        }
}

eg then

<script language="JavaScript">
preload('submit0','images/submit0.gif');
preload('submit1','images/submit1.gif');
</script>

Then you still have to use the object in your references to actually display
it.


-----Original Message-----
From: Mark Derricutt [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 17 July 2001 9:47 a.m.
To: Multiple recipients of list offtopic
Subject: [DUG-OFFTOPIC]: OT: re-using web images


Hiya, a bit off topic, in a webapp I'm writing I end up having about 100 
references to an img file (small bullet point), which seems to take ages to 
load up (the webserver sits there for ages pumping out these bullet 
images), does anyone know if theres any funky java script thing I can do to 
preload the image once into the browser, then simply reuse it and save on 
the download time?

-- 
Vi de ud�delige inviterer dere til � sl� dere sammen med oss

---------------------------------------------------------------------------
  New Zealand Delphi Users group - Offtopic List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe offtopic"
Web Archive at: http://www.mail-archive.com/offtopic%40delphi.org.nz/
---------------------------------------------------------------------------
  New Zealand Delphi Users group - Offtopic List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe offtopic"
Web Archive at: http://www.mail-archive.com/offtopic%40delphi.org.nz/

Reply via email to