Forum Moderators: coopster
Michael proposes a javascript solution to allow a browser to load images in a particular sequence. However, in practice I have not been able to get his script to work.
Is there PHP solution to this problem? I just want a table of images to load from left to right, top to bottom, every time no matter what the size of the image.
There seem to be another accepted method of doing this with javascript - but I recommend against an onload img attribute because it isn't valid HTML and also it isn't supported by NS7 (Gecko).
Here is the script, hope it will help save someone else all the research I did.
var imgArray = new Array("bg_01","bg_02","bg_03","bg_04","bg_05");
var len = imgArray.length
var imgDir = ""; //path to your images dir
var num = 0;
for (i = 0; i < len; i++) {
imageObj1 = imgArray[i] + "";
temp = eval(imageObj1 + " = new Image()");
temp.src = imgDir + imageObj1 + ".jpg";
}
function ImageSequence() {
eval("document."+imgArray[num]+".src = "+imgArray[num]+".src");
num = num + 1;
if (num < len) {
setTimeout("ImageSequence()", 1000);
}
}