开发者

Create a <li> for every image in a folder with a jQuery plugin or Javascript

开发者 https://www.devze.com 2023-02-26 02:54 出处:网络
Is there a way to append a <ul> with <li> of images from a folder using only javascript? I\'m able to create t开发者_JAVA技巧his functionality with server side technology but I wondered if

Is there a way to append a <ul> with <li> of images from a folder using only javascript? I'm able to create t开发者_JAVA技巧his functionality with server side technology but I wondered if there was some sort of client side technology that would do the magic as well.

I'm wanting to create a gallery of thumbnails without server side programming.


Not without server side code, javascript is a client side language and can not access the file system. Imagine the massive security issues if anyone could run code on against your personal file system!


No, javascript cannot directly interact with the filesystem (servers or clients). You could potentially create a service you could call via ajax that returns the images, but you will require at least a partial server side solution.


Pretty sure thats impossible! even if you use ajax you will still have to have the server side code looking through the images and returning them.


JQuery code:

$("img").wrap('<li>').wrap('<ul>');

this command will search for all image tags and will wrap them with

<ul>
 <li>
   <img .....>
 </li>
</ul>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号