<script type="text/javascript" src="js/jquery1.7.js"></script>

<script type="text/javascript">
$(function () {
    var show_count = 20;   //要显示的条数
    var count = 1;    //递增的开始值,这里是你的ID
    $("#btn_addtr").click(function () {
        var length = $("#dynamicTable tbody tr").length;
        //alert(length);
        if (length < show_count)    //点击时候,如果当前的数字小于递增结束的条件
        {
            $("#tab11 tbody tr").clone().appendTo("#dynamicTable tbody");   //在表格后面添加一行
            changeIndex();//更新行号
        }
    });
});
function changeIndex() {
    var i = 1;
    $("#dynamicTable tbody tr").each(function () { //循环tab tbody下的tr
        $(this).find("input[name='NO']").val(i++);//更新行号
    });
}
function deltr(opp) {
    var length = $("#dynamicTable tbody tr").length;
    //alert(length);
    if (length <= 1) {
        alert("至少保留一行");
    else {
        $(opp).parent().parent().remove();//移除当前行
        changeIndex();
    }
}
</script>
 
 

<div style="width:720px;margin:20px auto;">

<table >
</td>
</tr>
</tbody>
</table>

</div>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
  • 2022-12-23
相关资源
相似解决方案