{
vartable =document.getElementById("tab1")
varrows = table.rows.length
alert('行数'+rows)
varcolums = table.rows[0].cells.length
alert('列数'+colums)
}
----根据列数自动循环显示隐藏
JS获取表格行数和列数 function show() { var tab = document.getElementById("test") //表格行数 var rows = tab.rows.length //表格列数 var cells = tab.rows.item(0).cells.length alert("行数"+rows+"列数"+cells)} nbspnbsp