Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
115 views
in Technique[技术] by (71.8m points)

javascript - 使用javascript使用目录文件填充select(populate select with directory files using javascript)

I'm trying to make a form that has a select box in which displays all the images files I have in an specific folder.

(我正在尝试制作一个具有选择框的表单,其中显示我在特定文件夹中的所有图像文件。)

The idea is something like this:

(这个想法是这样的:)

I have this folder /PATH/TO/FOLDER that contains 5 images (image1, image2, image3...).

(我的这个文件夹/ PATH / TO / FOLDER包含5张图像(image1,image2,image3 ...)。)

The form would be like the one down here but each option is one of the images inside the folder.

(表单就像下面的表单一样,但是每个选项都是文件夹内的图像之一。)

<form action="SOMETHING HERE">
  <select name="images">
    <option value="">image1</option>
    <option value="">image2</option>
    ...
    <option value="">image5</option>
  </select>
  <br><br>
  <input type="submit">
</form> 

But instead of manually adding each option it has to be dinamicaly generated so that when i add new images to the folder it will update the select.

(但是,不是手动添加每个选项,而是必须动态生成,以便当我将新图像添加到文件夹时它将更新选择。)

  ask by Beatriz Couto de Carvalho translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...