<html>
<head>
<script type="text/javascript">
function show()
{
var tab = document.getElementById("test")
//表格行数
var rows = tab.rows.length
//表格列数
var cells = tab.rows.item(0).cells.length
alert("行数"+rows+"列数"+cells)
}
</script>
</head>
<body>
<table id="test" border="1">
<tr>
<td></td><td>nbsp</td>
</tr>
<tr>
<td></td><td>nbsp</td>
</tr>
</table>
<input type="button" onclick="show()"/>
</body>
</html>
function init()
{
vartable =document.getElementById("tab1")
varrows = table.rows.length
alert('行数'+rows)
varcolums = table.rows[0].cells.length
alert('列数'+colums)
}
----根据列数自动循环显示隐藏