image precaching

Giganews Newsgroups
Subject: image precaching
Posted by:  viza (none@example.invalid)
Date: Thu, 31 Jul 2003

Hi!

This does not seem to work:

function cacheimage(source){
  myimg=new Image()
  myimg.src=source
}
cacheimage('closed1.jpg')

Is this because the myimg object is destroyed as soon as the function
returns, or for some other reason?  Does anyone have a simple, one argument,
void returning function with where you can give the url of an image and have
it precahed like this?

Any answer must work in IE5+.

Thanks!

Replies