tr sectionRowIndexプロパティ
tr オブジェクト
定義と用法
sectionRowIndex プロパティは、TBODY、THEAD、または TFOOT 内の行の位置を返します。rowsコレクション内の位置
構文
sectionRowIndex プロパティを返します:
trObject.sectionRowIndex
ヒント:sectionRowIndex プロパティにはデフォルト値がありません。
ブラウザサポート
![]()
![]()
![]()
![]()
![]()
すべての主要ブラウザは sectionRowIndex プロパティをサポートしています。
例
例
THEAD、TBODY、tFoot の Rows コレクションの行の位置をポップアップ表示します:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>初心者チュートリアル(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>クリックして行インデックスを表示</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>
<html>
<head>
<meta charset="utf-8">
<title>初心者チュートリアル(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>クリックして行インデックスを表示</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 オブジェクト その他の拡張