About the script below, I think that when I add more graphic file names to the array, it takes longer to load the page. So is there a strategy I can take to still display my graphics randomly and have my page load fast?
Code is from the first page of [url]www.stationisland.com.
<SCRIPT LANGUAGE=”JavaScript”>
<!– Begin
var rand1 = 0;
var useRand = 0;
images = new Array;
images[01] = new Image();
images[01].src = “blueHand.jpg”;
images[02] = new Image();
images[02].src = “wallCloud.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;
}
images = new Array;
images[01] = new Image();
images[01].src = “blueHand.jpg”;
images[02] = new Image();
images[02].src = “wallCloud.jpg”;
images[03] = new Image();
images[03].src = “lroom1.jpg”;
images[04] = new Image();
images[04].src = “newHousePaint.jpg”;
images[05] = new Image();
images[05].src = “nrb.jpg”;
images[06] = new Image();
images[06].src = “forest.jpg”;
images[07] = new Image();
images[07].src = “rootBody.jpg”;
images[08] = new Image();
images[08].src = “wind.jpg”;
images[09] = new Image();
images[09].src = “prb.jpg”;
// End –>
</script>
</head>
<body OnLoad=”swapPic()”