码迷,mamicode.com
首页 > Web开发 > 详细

js 表格插入指定行

时间:2017-07-10 16:42:25      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:element   row   get   pac   table   span   ntb   ted   doc   

js在table指定tr行上或下面添加tr行

function onAddTR(trIndex) 
        { 
            var tb = document.getElementById("tb1"); 
            var newTr = tb.insertRow(trIndex);//添加新行,trIndex就是要添加的位置 
            var newTd1 = newTr.insertCell(); 
            newTd1.innerHTML = "这是新行,位置:" + trIndex; 
            var newTd2 = newTr.insertCell(); 
            newTd2.innerHTML = "这是新行,位置:" + trIndex; 
        } 

 

http://www.cnblogs.com/caicaizi/p/4952551.html

js 表格插入指定行

标签:element   row   get   pac   table   span   ntb   ted   doc   

原文地址:http://www.cnblogs.com/jphoebe/p/7145936.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!