Hi
I'm using this code to preload images in my e-commerce website. Can't remember where I got the script but it works.
<SCRIPT LANGUAGE="JavaScript">
var aryImages = new Array();
aryImages[0] = "prod_1_A.jpg";
aryImages[1] = "prod_1_B.jpg";
aryImages[2] = "prod_1_C.jpg";
aryImages[3] = "prod_1_D.jpg";
for (i=0; i < aryImages.length; i++) {
var preload = new Image();
preload.src = aryImages[i];
}
</script>
I have around 600 products on my site, some have 2 images, some 4 images etc and would like to have one script that does all instead of 600 slightly different scripts.
So, the question is, what happens if I add two more images, prod_1_E & prod_1_F, to the array even tho they don't exist?
I've tried it and it seems to work. Just wanted to know if it's OK or will I hit probs further down the line.
Cheers
Ian



Reply With Quote


Bookmarks