tr sectionRowIndex 屬性

定義和用法
TsectionRowIndex 屬性返回某一行在TBODY,THEAD,或TFOOT rows 集合中的位置
語法
返回 sectionRowIndex 屬性:
trObject.sectionRowIndex
提示: sectionRowIndex 屬性沒有默認值。
流覽器支持
所有主流流覽器都支持 sectionRowIndex 屬性
實例
實例
彈出THEAD,TBODY,tFoot Rows集合的行的位置:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.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>IT研修(xuhuhu.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>
