View Full Version : preload image issue

04-04-2003, 06:07 PM
I am trying to preload some images to my page. But after reviewing the threads here and the code, I don't think I am doing it right. I think that I am actually loading the images several times. :mad:

var r=0
var imgno=0

// create the array to load the full size images , thumbnails and composite pages if applicable
var photos = new Array(
new Array("Headshots/MarH0022V.jpg","Headshots/MarH0022T.jpg","Pages/CP_MarH I.html"),
new Array("Headshots/NicM0421V.jpg","Headshots/NicM0421T.jpg","Pages/CP_NicM.html"),
new Array("Headshots/DouB0296V.jpg","Headshots/DouB0296T.jpg","Pages/CP_DouB I.html"),
new Array("Headshots/SteP0004V.jpg","Headshots/SteP0004T.jpg","Pages/CP_SteP.html"),
new Array("Headshots/DiaJ0468V.jpg","Headshots/DiaJ0468T.jpg","Pages/CP_DiaJ.html"),
new Array("People/Fash0070VBW.jpg","People/Fash0070TBW.jpg",null)

// Preload the images
function setImg() {
var imgAry = new Array();
var imgtn = new Array();
// for each row
for(x=0; x<photos.length; x++) {
//imgAry[x] = new Image();//full size images
imgtn[x] = new Image();//thumnails
//imgAry[x].src = photos[x][0];
imgtn[x].src = photos[x][1];

document['bigimg'].src = photos[0][0];
document['tn0'].src = photos[0][1];
document['tn1'].src = photos[1][1];
document['tn2'].src = photos[2][1];
document['tn3'].src = photos[3][1];
document['tn4'].src = photos[4][1];
document['tn5'].src = photos[5][1];

function next() {

// image swap function
function Blowup(r) {
document['bigimg'].src = photos[r][0];
composite ()

any suggestions?