var i =0;
var n=<%=_n %>;
function addFileControl()
{
if(i<(9-n))
{
var str = '<INPUT type="file" NAME="File"><br/>'
document.getElementById('FileCollection').insertAdjacentHTML("beforeEnd",str)
i++;
}else
{
alert('最多只能上传10个,还剩'+(10-n)+'个可上传!')
}
}
</script>
以下是body内
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" style="width: 227px; height: 25px">
上传新图片
</td>
<td style="height: 25px" width="72%">
<input onclick="addFileControl()" type="button" value="增加上传" />
<div id="FileCollection">
<input id="File1" runat="server" name="File" type="file" /><br />
</div>
</td>
</tr>
<tr>
<td align="center" style="width: 227px; height: 25px">
图片说明
</td>
<td style="height: 25px">
<asp:TextBox ID="txtTPSM" runat="server" MaxLength="25"></asp:TextBox>
</td>
</tr>
<tr style="color: #000000">
<td height="25" style="width: 227px">
</td>
<td height="25">
<asp:Button ID="btnAdd" runat="server" Text="上传" OnClick="btnAdd_Click" />
</td>
</tr>