JavaScript Reference/Javascript Collections/tBodies
Содержание
"tBodies" Example
<html>
<body>
<table id="myTable" width="16%" border="1">
<tbody>
<tr><td>Row 1</td></tr>
<tr><td>Row 2</td></tr>
<tr><td>Row 3</td></tr>
</tbody>
<tbody>
<tr><td>Row 4</td></tr>
<tr><td>Row 5</td></tr>
<tr><td>Row 6</td></tr>
</tbody>
</table>
<button onclick="function1();">Get total number of tbody elements</button>
<script language="JavaScript">
function function1() {
var m = document.getElementById("myTable").tBodies.length;
alert(m);
}
</script>
</body>
</html>
"tBodies" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<table> |
+----------------+--------------------------------------------------------------+
"tBodies" JavaScript properties and JavaScript methods
JavaScript properties and JavaScript methods
item(), length, namedItem(), tags(), urns()
"tBodies" Syntax Parameters and Note
Note:
Returns an array of all <tbody> elements in a table, both specified and implied.
Syntax:
document.getElementById("tableID").tBodies // returns all tbodies
document.getElementById("tableID").tBodies(param1, param2) // returns an individual tbody
document.all.tableID.tbodies // IE only
document.all.tableID.tbodies(param1, param2) // IE only
Parameters:
param1 Required; zero-based index
the desired member"s id or name attribute.
param2 Optional; the zero-based index for the resultset
if param1 matches more than one element.