View Single Post
Old 12-01-2012, 05:23 PM   PM User | #16
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Where are the image src and descriptions coming from? If you are using a server-side script to retrieve these details from a database, file or folder, then constructing and populating a multi-dimensional array within a loop is the way to go.

If the details are fixed then you would just hard-code the array:

Code:
var imgDetails = [];
imgDetails[0] = [ "path/image1.gif", "Some great description."];
imgDetails[1] = [ "path/image2.gif", "Some other great description."];
// etc.

// details are retrieved as:
imgDetails[0][0];    // the first image path
imgDetails[0][1];    // the first description

// the number of images can just be set in stone, or read using length:
var imgLength = 10;    // or
var imgLength = imgDetails.length;
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote