js获取表格列的值
var oTd = document.getElementById("tableId").rows(0).cells(0).innerText;
//表格行数
var row = document.getElementById("tableId").rows.length;
------------------------------------------------------------------------------------------------------------------
//表格姓名列名字相同时序号相同
function addCell(){
var num=4; //第四行开始
var next_num = num+1;
var _num = num-3;//序号
for(var i=0;i<document.getElementById("tableId").rows.length;i++){
if(next_num < document.getElementById("tableId").rows.length-1){
var oTd = document.getElementById("tableId").rows(num).cells(1).innerText;
var oTd1 = document.getElementById("tableId").rows(next_num).cells(1).innerText;
if(oTd == oTd1){//第一行名字和第二行相同时序号相同
document.getElementById("tableId").rows(num).cells(0).innerText = _num;
document.getElementById("tableId").rows(next_num).cells(0).innerText = _num;
}else{
if(num==4){
document.getElementById("tableId").rows(num).cells(0).innerText = _num;
}
document.getElementById("tableId").rows(next_num).cells(0).innerText = _num+1;
_num++; //不相同时序号加1
}
num++;
next_num++;
}
}
}