主要的js方法如下:
function addRow(){
var input = document.createElement('input');
input.setAttribute("type","file");
input.setAttribute("size","55");
input.setAttribute("name","theFile");
$("#theFile").after(input);
$("#theFile").after(document.createElement("BR"));
}
jsp页面中的元素如下:
<TR>
<th width="137" align="right"><strong>文件选择:</strong></tdh>
<TD vAlign=top>
<input name="theName" type="hidden" size="40">
<input class="formInputText" name=theFile id="theFile" type=file size="60" onpropertychange="MM_changeProp2(this.value)">
<input type="button" id="filebtn" name="filebtn" class="formInputText" value="继续添加" οnclick="addRow()">
</TD>
</TR>
效果图如下:
转载于:https://blog.51cto.com/butcher36/1550496