//HTML
<a href="javascript:void(0)" οnclick="AddAttachment()">[点击添加附件]</a>
<table cellpadding="0" cellspacing="3" id="id_attachmentpanel"></table>
=========================================================
//新增文章页面
function AddAttachment() {
var objTable = $("#id_attachmentpanel");
var intCount = $("#id_attachmentpanel tr").children().size() / 2 + 1;
if (intCount > 5) { alert("附件不能超过5个"); return; }
objTable.append("<tr><td>" + intCount + ". <input type='file' name='file" + intCount + "' οnchange='FileExtChecking(this,1)' /></td><td><a href='javascript:void(0)' οnclick='AddAttachment()'>[增加]</a><a href='javascript:void(0);' οnclick='DisposeTr(this)'>[取消]</a></td></tr>");
$("#id_attachmentpanel a").hide();
$("#id_attachmentpanel a").last().show();
if (intCount < 5) { $("#id_attachmentpanel a").last().prev().show(); }
}
function DisposeTr(arg_obj_item) {
var objTr = $(arg_obj_item).parent().parent();
objTr.remove();
$("#id_attachmentpanel a").last().show();
$("#id_attachmentpanel a").last().prev().show();
}
============================================================
//编辑文章页面
function AddAttachment() {
var intAttach = '<%=intAttach %>';
var objTable = $("#id_attachmentpanel");
var intCount = $("#id_attachmentpanel tr").children().size() / 2 + 1;
if (intCount > (5-intAttach)) { alert("附件不能超过5个"); return; }
objTable.append("<tr><td>" + intCount + ". <input type='file' name='file" + intCount + "' οnchange='FileExtChecking(this,1);' /></td><td><a href='javascript:void(0)' οnclick='AddAttachment()'>[增加]</a><a href='javascript:void(0);' οnclick='DisposeTr(this)'>[取消]</a></td></tr>");
$("#id_attachmentpanel a").hide();
$("#id_attachmentpanel a").last().show();
if (intCount < (5-intAttach)) { $("#id_attachmentpanel a").last().prev().show(); }
});
function DisposeTr(arg_obj_item) {
var objTr = $(arg_obj_item).parent().parent();
objTr.remove();
$("#id_attachmentpanel a").last().show();
$("#id_attachmentpanel a").last().prev().show();
}
==========================================
<a href="javascript:void(0)" οnclick="AddAttachment()">[点击添加附件]</a>
<table cellpadding="0" cellspacing="3" id="id_attachmentpanel"></table>
=========================================================
//新增文章页面
function AddAttachment() {
var objTable = $("#id_attachmentpanel");
var intCount = $("#id_attachmentpanel tr").children().size() / 2 + 1;
if (intCount > 5) { alert("附件不能超过5个"); return; }
objTable.append("<tr><td>" + intCount + ". <input type='file' name='file" + intCount + "' οnchange='FileExtChecking(this,1)' /></td><td><a href='javascript:void(0)' οnclick='AddAttachment()'>[增加]</a><a href='javascript:void(0);' οnclick='DisposeTr(this)'>[取消]</a></td></tr>");
$("#id_attachmentpanel a").hide();
$("#id_attachmentpanel a").last().show();
if (intCount < 5) { $("#id_attachmentpanel a").last().prev().show(); }
}
function DisposeTr(arg_obj_item) {
var objTr = $(arg_obj_item).parent().parent();
objTr.remove();
$("#id_attachmentpanel a").last().show();
$("#id_attachmentpanel a").last().prev().show();
}
============================================================
//编辑文章页面
function AddAttachment() {
var intAttach = '<%=intAttach %>';
var objTable = $("#id_attachmentpanel");
var intCount = $("#id_attachmentpanel tr").children().size() / 2 + 1;
if (intCount > (5-intAttach)) { alert("附件不能超过5个"); return; }
objTable.append("<tr><td>" + intCount + ". <input type='file' name='file" + intCount + "' οnchange='FileExtChecking(this,1);' /></td><td><a href='javascript:void(0)' οnclick='AddAttachment()'>[增加]</a><a href='javascript:void(0);' οnclick='DisposeTr(this)'>[取消]</a></td></tr>");
$("#id_attachmentpanel a").hide();
$("#id_attachmentpanel a").last().show();
if (intCount < (5-intAttach)) { $("#id_attachmentpanel a").last().prev().show(); }
});
function DisposeTr(arg_obj_item) {
var objTr = $(arg_obj_item).parent().parent();
objTr.remove();
$("#id_attachmentpanel a").last().show();
$("#id_attachmentpanel a").last().prev().show();
}
==========================================