javascript实现多个上传控件

<html>
<head>
   <script type="text/javascript">
       function add() {
           var br = document.createElement("br");
           var file = document.createElement("input");
           var button = document.createElement("input");
           file.type = "file";
           file.name = "file";
           button.type = "button";
           button.name = "addbutton";
           button.value = "remove";
           var td = document.getElementById("upload");
           td.appendChild(br);
           td.appendChild(file);
           td.appendChild(button);

           button.onclick = function () {
               td.removeChild(br);
               td.removeChild(file);
               td.removeChild(button);
           }

       }
</script>
</head>
<body>
   <table align="center" width="50%" border="1">
   <td id="upload"><input type="file" name="upload" /><input type="button" name="add" onClick="add()" value="add more"/></td>
   </table>
</body>
</html>
原文地址:https://www.cnblogs.com/caok168/p/2581954.html