利用原生JS进行HTML行删除

利用原生JS进行HTML行删除代码如下
var tab = document.getElementById("listTbody");//tbody的id
            var tBodies = tab.tBodies;
            var rows = null;
            if(tBodies){
                var tBody = tab.tBodies[0];
                rows = tBody.rows;
            } else {
                rows = tab.rows;
            }
            var rowCount = rows.length;
            for(var i = rowCount -1;i >= 0;i--){
                tab.deleteRow(i);
            }

你可能感兴趣的:(html,jsp)