首页 > Web开发 > 详细

JS添加tr序号

时间:2015-11-02 18:50:07      阅读:274      评论:0      收藏:0      [点我收藏+]
    <script>
        var a = 2;
        var bb=0;
        function add() {           
            a++;
            var newRow = $("#templateTr").html();
            $("#templateTr").find(".spth").html(a);
            $(".aaa").before(newRow);
            $(".numberspan").html((a));
            bb = a + 1;
            $("#templateTrMade").find(".madespth").html(bb);
        }
        function remove() {
            var index = $(".aaa").index();
            if (index > 5) {
                $("table").find("tr").eq(index).remove();
                a--;
                $("#templateTr").find(".spth").html(a);
                $(".numberspan").html((a));
                bb = a + 1;
                $("#templateTrMade").find(".madespth").html(bb);
            }
        }
    </script>

 

JS添加tr序号

原文:http://www.cnblogs.com/happinesshappy/p/4930902.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!