【Js--代码模块】多附件上传和修改附件

function AddAttachment(maxNum) {
        var objTable = $("#id_attachmentpanel");
        var exitsAtt=document.getElementsByName('exits_atta');
        var intCount = $("#id_attachmentpanel tr").children().size() / 2 + 1+exitsAtt.length;
        if (intCount > maxNum) { alert("附件不能超过"+maxNum+"个"); 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("+maxNum+")'>[增加]</a><a href='javascript:void(0);' οnclick='DisposeTr(this)'>[取消]</a></td></tr>");
        objTable.append("<tr><td><input type='file' name='file'/></td><td><a href='javascript:void(0)' οnclick='AddAttachment("+maxNum+")'>[增加]</a><a href='javascript:void(0);' οnclick='DisposeTr(this)'>[取消]</a></td></tr>");
        $("#id_attachmentpanel a").hide();
        $("#id_attachmentpanel a").last().show();
        if (intCount < maxNum) { $("#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();
    }
{% if attachments %}
  {% for attachment in attachments %}
    <span name='exits_atta'>
	<a href={{attachment.file}} name='exits_atta_name'>{{attachment.file}}</a>  
	<label id={{attachment.id}} style="cursor: pointer;text-decoration:underline;" οnclick="delete_attach(this)">删除</label><br>
     </span>
   {% endfor %}
{% endif %}
   <label style="cursor: pointer;text-decoration: underline;" οnclick="AddAttachment(5)">添加附件</label>
   <table cellpadding="0" cellspacing="3" id="id_attachmentpanel"></table>
   <input id='needToDelete_att' name="needToDelete_att" style="display:none" />


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值