js控制 点一下增加一个输入框,点一下增加一个输入框……
<div> <div> 附件1:<input type="file" id="file1" name="file1" /> <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" onclick="addFile(document.getElementById('filesDiv').innerHTML)"">更多附件</a> </div> <div id="filesDiv"></div> </div>
<script type="text/javascript"> var i =2; function addFile(param){ param += "<div>附件"+i+":<input type='file' id='file"+i+"'"+" name='file"+i+"'"+"/> "+"</div>"; document.getElementById("filesDiv").innerHTML = param; i=i+1; } </script>
效果图: