<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input type="file" name="file" id="file" multiple="multiple" /> <div id="info_box"></div> <script> var fileDom = document.getElementById("file"); var infoBoxDom = document.getElementById(‘info_box‘); fileDom.addEventListener("change", upload, false); function upload(){ var list = this.files; for( var i = 0 ; i < list.length ; i++ ){ infoBoxDom.innerHTML += list[i].name+"<br>"; } infoBoxDom.innerHTML += list.length+‘个文件‘; } </script> </body> </html>
时间: 2024-10-14 04:51:15