tr sectionRowIndexProperty

tr 对象参考手册tr Object

Definition and Usage

The sectionRowIndex property returns the position of a row in the TBODY, THEAD, or TFOOTrowscollection.

Syntax

Return the sectionRowIndex property:

trObject.sectionRowIndex

Tip:The sectionRowIndex property has no default value.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the sectionRowIndex property.


Example

Example

Pop up the position of the row in the THEAD, TBODY, tFoot Rows collection:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function displayResult(x){
    alert("Section row index is: " + x.sectionRowIndex);
}
</script>
</head>
<body>

<table border="1">
    <thead>
        <tr onclick="displayResult(this)">
<th>Click to show row index</th>
        </tr>
        <tr onclick="displayResult(this)">
<th>Click to show row index</th>
        </tr>
</thead>
<tbody>
        <tr onclick="displayResult(this)">
<td>Click to show row index</td>
        </tr>
        <tr onclick="displayResult(this)">
<td>Click to show row index</td>
        </tr>
</tbody>
<tfoot>
        <tr onclick="displayResult(this)">
<td>Click to show row index</td>
        </tr>
        <tr onclick="displayResult(this)">
<td>Click to show row index</td>
        </tr>
</tfoot>
</table>

</body>
</html>

Try it »


tr 对象参考手册tr Object Other Extensions