JavaScript Reference/Javascript Collections/tBodies

Материал из Web эксперт
Перейти к: навигация, поиск

"tBodies" Example

   <source lang="javascript">
   

<html> <body>

<tbody>
   </tbody>
   <tbody>
   </tbody>
Row 1
Row 2
Row 3
Row 4
Row 5
Row 6

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


     </source>
   
  


"tBodies" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+

| Applied_To | | +----------------+--------------------------------------------------------------+ </source>

"tBodies" JavaScript properties and JavaScript methods

   <source lang="javascript">

JavaScript properties and JavaScript methods

item(), length, namedItem(), tags(), urns()


     </source>
   
  


"tBodies" Syntax Parameters and Note

   <source lang="javascript">

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.
   
     
</source>