js动态表格

 

var table = document.getElementById("tableId");

//清空表格数据

$("#tableId tbody").html("");

//添加标题行,实际就是普通行加些属性

newth = table.insertRow();

newth.style.backgroundColor="#ccc";//灰色

newth.style.fontWeight="bold";//本行字体加粗

//在行上加单元格

var td0 = newth.insertCell();

td0.innerHTML = "单元格内容";

td0.width = "20";

//不显示单元格

td0.style.display = "none";

//排版

td0.align = "center";

td0.nowrap = "nowrap";

 

posted @ 2016-09-01 11:10  张主任好  阅读(85)  评论(0)    收藏  举报