<html>
<head>
<script type="text/javascript">
function show()
{
var tab = document.getElementById("tab") ;
//表格行数
var rows = tab.rows.length ;
//表格列数
var cells = tab.rows.item(0).cells.length ;
alert("行数为:"+rows+"列数为:"+cells);
}
</script>
</head>
<body>
<table id="tab" border="1">
<th>
<td>标题1</td><td>标题2</td>
</th>
<tr>
<td>AA</td><td>BB</td>
</tr>
<tr>
<td>aa</td><td>bb</td>
</tr>
</table>
<input type="button" οnclick="show();"/>
</body>
</html>