<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" >
<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>