主要的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
最后
以上就是贤惠衬衫最近收集整理的关于关于js动态添加上传文件框的全部内容,更多相关关于js动态添加上传文件框内容请搜索靠谱客的其他文章。
发表评论 取消回复