JavaScript Reference/Javascript Collections/cells

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

"cells" Example

    
<html>
<body>
<table id="myTable" border="1">
    <tr id="myRow">
        <td>Cell 1</td>
        <td>Cell 2</td>
    </tr>
    <tr>
        <td>Cell 3</td>
        <td>Cell 4</td>
    </tr>
</table>
<button onclick="alert(myTable.cells.length);">Length of table</button>
<button onclick="alert(myRow.cells.length);">Length of row</button>
</body>
</html>



"cells" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<table>                         <tr>                          |
+----------------+--------------------------------------------------------------+



"cells" JavaScript properties and JavaScript methods

JavaScript properties and JavaScript methods
 
item(), length, namedItem(), tags(), urns()



"cells" Syntax Parameters and Note

Note:
Returns an array of all cells in a <table> or <tr> element.
    
Syntax:
    
document.all.elementID.cells // returns all cells
document.all.elementID.cells(param1, param2) // returns an individual cell

    param1   Required; zero-based index or 
                       the value of the desired member"s id or name attribute.
                       
    param2   Optional; zero-based index for the result returned
                       if param1 matches more than one element.