cellIndex property (td, th)
Returns a zero-based integer that indicates the position of a cell (td or th) in the cells collection of a table row.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read-only.
Possible values:
Zero-based integer that retrieves the position of the td element.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the cellIndex property:
|
||||
<head> <script type="text/javascript"> function GetCellPos () { var cellPos = document.getElementById ("myCell").cellIndex; alert (cellPos); } </script> </head> <body> <table border="1px"> <tr> <td>First cell in the table</td> <td id="myCell">Second cell id = myCell</td> </tr> </table> <button onclick="GetCellPos ()">Get myCell's position!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments