rowIndex property (tr)
This property is similar to the sectionRowIndex property.
The rowIndex property retrieves the position of a row in the entire table,
while the sectionRowIndex property retrieves the position in the section that contains the 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 represents the position of the row.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the rowIndex property:
|
||||
<head> <script type="text/javascript"> function OnRowClick (row) { alert ("Index in the table: " + row.rowIndex + "\nIndex in the section: " + row.sectionRowIndex); } </script> </head> <body> Click on the rows of the table!<br /><br /> <table border="1px"> <thead> <tr onclick="OnRowClick (this)"> <th>Fruit</th> <th>Cost per kilo</th> </tr> </thead> <tbody> <tr onclick="OnRowClick (this)"> <td>Apple</td> <td>$5</td> </tr> <tr onclick="OnRowClick (this)"> <td>Pear</td> <td>$10.50</td> </tr> <tr onclick="OnRowClick (this)"> <td>Peach</td> <td>$23.30</td> </tr> </tbody> <tfoot> <tr onclick="OnRowClick (this)"> <td></td> <td>$38.80</td> </tr> </tfoot> </table> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
HTML elements:
Related pages:
External links:
User Contributed Comments