Problem in displaying all images inside the folder using javascript
Hi,
For my project I m using jquery bulit in photo slide show,jquery code is taking images from array and displaying the images..The problem is I have a lot of images which I don't want to put it in Array(because it need manual effort) instead of that I wa开发者_如何学Cnt to read each image from the folder and display the images. the advantage of doing so is whenever you want to add more images you need to drop it in folder since you are reading images from folder so need not to do any thing in code level.so it makes your work easier and simpler.. so is there any way to achieve the same using javascript?.
Thanks in Adavance.
Javascript being client-side, it's possible to list the content of a server directory with it. You'll need some server side scripting to do that, like PHP. see this SO question for an example
I think you should add an Ajax
request to get the names of file in the directory.
After you can just pass along the array and show only those images in the slideshow.
精彩评论