[thelist] Site Evaluation - Crush Kill Destroy + URL
Niklaus Haldimann
n.haldimann at derbund.ch
Tue Jul 4 08:35:48 CDT 2000
><2>
>I've used a Javascript array to preload my images:
>//Preloader
>function ImgGlobal() {
> if(document.images) {
> globals = new Array();
> globals[1] = new Image(400,360); globals[1].src = "logo.gif";
> globals[2] = new Image(560,10); globals[2].src = "spacer.gif";
> //etc
> globals[20] = new Image(100,100); globals[20].src = "dot.gif";
> }
>}
>Is this the most efficient method of preloading?
I don't know 'bout efficiency, but the following is what I use and it's at
least less code:
function ImgGlobal() {
if(document.images) {
globals = new Array();
for (i=1;i<=20;i++) globals[i]=new Image();
globals[1].src = "logo.gif";
globals[2].src = "spacer.gif";
//etc
globals[20].src = "dot.gif";
}
}
I don't think adding the dimensions when preloading images does improve
speed. But I might be wrong.
--
niklaus haldimann - web wiz @ der bund verlag ag
at work: http://www.ebund.ch
at play: http://ubique.virtualave.net new*orange!
More information about the thelist
mailing list