<head>
<script language="javascript">
// must have the onload handler
onload = function countRows(){
var rows = document.getElementById('myTableId').getElementsByTagName('tbody')[0].rows.length;
alert( rows);
// outputs 3
}
</script>
</head>
<body>
<table id="myTableId">
<tbody>
<tr><td></td><td><input onclick="doA_Function_That_Includes_CountRows()" />
</td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</tbody>
</table>
</body>
</html>
задан phpmeh 23 February 2012 в 16:33
поделиться