[thelist] Image preload problem NN6

Tyme nopun at bellsouth.net
Fri Jul 27 10:44:42 CDT 2001


Reference: http://www.huntacpa.com/

Any idea why this .js script does not appear to be preloading the images for
Netscape 6?  Works fine for IE4 and IE5.01.  (File is called in
<head></head>.)

Code:

var rand1 = 0;
var useRand = 0;

images = new Array;
images[1] = new Image(190,290);
images[1].src = "photo1.jpg";
images[2] = new Image(190,290);
images[2].src = "photo2.jpg";
images[3] = new Image(190,290);
images[3].src = "photo3.jpg";
images[4] = new Image(190,290);
images[4].src = "photo4.jpg";
images[5] = new Image(190,290);
images[5].src = "photo5.jpg";


function swapPic() {
var imgnum = images.length - 1;
do {
var randnum = Math.random();
rand1 = Math.round((imgnum - 1) * randnum) + 1;
} while (rand1 == useRand);
useRand = rand1;
document.randimg.src = images[useRand].src;
}

<body onLoad="swapPic()" bgcolor="tan" background="sand_bg.gif">






More information about the thelist mailing list