PDA

View Full Version : Loading images into an array from a directory



yaip
07-25-2008, 03:20 PM
I have the following hard-coded JavaScript:

fadeimages[0]=["photo1.jpg", "", ""]
fadeimages[1]=["photo2.jpg", "", ""]
fadeimages[2]=["photo3.jpg", "", ""]

instead, I want to load all images in a specific directory into the array. I don't know the number of images so I don't know the size of the array. It can vary depending on the number of images in the directory.

How wold I do this?

Dal
07-25-2008, 03:36 PM
You will find your answer by looking up .push

Dal

yaip
07-25-2008, 05:36 PM
Can you provide a link or an example?

yaip
07-25-2008, 05:42 PM
.push method adds an element to the array. But I want to retrieve a list of files from a directory in an array.

rangana
07-26-2008, 01:50 AM
You need server-side to accomplish this. You might have more luck on server-side section.