add image with jquery
How开发者_JAVA百科 can I add all images inside a folder to a div using jquery? and then is it possible that when I click on a link to change the folder, delete all current images and then add the new ones from the new folder?
jQuery has the same rights as JavaScript to access the file system in a browser environment - none.
The sane way would be to have some server side code hand an array to your JavaScript.
The utterly insane way would be to name your images \d.jpg
and have JavaScript request them until it 404s. This is so bad, you should never do it. I'm just mentioning this to say it is possible.
You cannot accomplish this entirely with jquery. You would need an intermediary script on the server that would accept requests for a list of images in a given directory, and then return that information to the client, which you could from there easily do what you want.
精彩评论