How to load all the images from one of my folder into my web page, using Jquery/Javascript

后端 未结 14 2286
情深已故
情深已故 2020-11-22 10:18

I have a folder named \"images\" in the same directory as my .js file. I want to load all the images from \"images\" folder into my html page using Jquery/Javascript.

<
14条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-22 11:06

    You can't do this automatically. Your JS can't see the files in the same directory as it.

    Easiest is probably to give a list of those image names to your JavaScript.

    Otherwise, you might be able to fetch a directory listing from the web server using JS and parse it to get the list of images.

提交回复
热议问题