用JAVASCRIPT控制添加FILE控件的个数
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function AddFile()
{
var strFile='<input name="File1" type="file" />';
document.getElementById("DivFile").insertAdjacentHTML("beforeEnd",strFile);
}
</script>
</head>
<body>
<form id="form1" runat="server" enctype="multipart/form-data">
附件:<div id="DivFile">
</div>
<input id="BtnAddFile" type="button" value="增加附件" onclick="javascript:AddFile()" />
<br />
</div>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function AddFile()
{
var strFile='<input name="File1" type="file" />';
document.getElementById("DivFile").insertAdjacentHTML("beforeEnd",strFile);
}
</script>
</head>
<body>
<form id="form1" runat="server" enctype="multipart/form-data">
附件:<div id="DivFile">
</div>
<input id="BtnAddFile" type="button" value="增加附件" onclick="javascript:AddFile()" />
<br />
</div>
</form>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货