Latest web development tutorials

HTML DOM tr sectionRowIndex 屬性

tr 對象參考手冊 tr對象

定義和用法

TsectionRowIndex屬性返回某一行在TBODY,THEAD,或TFOOT rows集合中的位置

語法

返回sectionRowIndex 屬性:

trObject.sectionRowIndex

提示: sectionRowIndex屬性沒有默認值。


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流瀏覽器都支持sectionRowIndex 屬性


實例

實例

彈出THEAD,TBODY,tFoot Rows集合的行的位置:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.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>单击显示行下标</th>
        </tr>
        <tr onclick="displayResult(this)">
        <th>单击显示行下标</th>
        </tr>
</thead>
<tbody>
        <tr onclick="displayResult(this)">
        <td>单击显示行下标</td>
        </tr>
        <tr onclick="displayResult(this)">
        <td>单击显示行下标</td>
        </tr>
</tbody>
<tfoot>
        <tr onclick="displayResult(this)">
        <td>单击显示行下标</td>
        </tr>
        <tr onclick="displayResult(this)">
        <td>单击显示行下标</td>
        </tr>
</tfoot>
</table>

</body>
</html>

嘗試一下»


tr 對象參考手冊 tr對象