- //取得table对象
- var tabObj = document.getElementById("tabTipResult");
- //目前table有多少行
- var rowCount = tabObj.rows.length;
- //每行有多少列
- var cellCount = tabObj.rows(0).cells.length;
- if(rowCount < pageCount)
- {
- for(var i=0;i< pageCount ;i++)
- {
- //循环 向table增加新行
- var newRow = tabObj.insertRow(rowCount++);
- for(var j=0;j<cellCount;j++)
- {
- //每行的新列值
- newRow.insertCell(j).innerHTML="无";
- }
- }
- }
- else
- {
- for(var i=1;i<= pageCount ;i++)
- {
- var tmpRow = tabObj.rows(i);
- for(var j=0;j<cellCount;j++)
- {
- tmpRow.cells(j).innerHTML="无";
- }
- //该行的背景色属性
- tmpRow .onmouseout = function(){this.bgColor="white";};
- tmpRow .οnmοuseοver= function(){this.bgColor="#efffff";};
- //td 在 onclick事件
- tmpRow .cells(0).onclick = function(){ alert("");};
- }
- }
- //删除列
- document.getElementById(tabTipResult).deleteRow(index);