HTML DOM tr sectionRowIndex 属性
tr sectionRowIndex 属性
tr 对象定义和用法
TsectionRowIndex 属性返回某一行在TBODY,THEAD,或TFOOT rows 集合中的位置
语法
返回 sectionRowIndex 属性:
trObject.sectionRowIndex
提示: sectionRowIndex 属性没有默认值。
浏览器支持
所有主流浏览器都支持 sectionRowIndex 属性
实例
实例
弹出THEAD,TBODY,tFoot Rows集合的行的位置:
<html>
<head>
<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 sectionRowIndex</th>
</tr>
<tr onclick="displayResult(this)">
<th>Click to show sectionRowIndex</th>
</tr>
</thead>
<tbody>
<tr onclick="displayResult(this)">
<td>Click to show sectionRowIndex</td>
</tr>
<tr onclick="displayResult(this)">
<td>Click to show sectionRowIndex</td>
</tr>
</tbody>
<tfoot>
<tr onclick="displayResult(this)">
<td>Click to show sectionRowIndex</td>
</tr>
<tr onclick="displayResult(this)">
<td>Click to show sectionRowIndex</td>
</tr>
</tfoot>
</table>
</body>
</html>
<head>
<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 sectionRowIndex</th>
</tr>
<tr onclick="displayResult(this)">
<th>Click to show sectionRowIndex</th>
</tr>
</thead>
<tbody>
<tr onclick="displayResult(this)">
<td>Click to show sectionRowIndex</td>
</tr>
<tr onclick="displayResult(this)">
<td>Click to show sectionRowIndex</td>
</tr>
</tbody>
<tfoot>
<tr onclick="displayResult(this)">
<td>Click to show sectionRowIndex</td>
</tr>
<tr onclick="displayResult(this)">
<td>Click to show sectionRowIndex</td>
</tr>
</tfoot>
</table>
</body>
</html>
尝试一下 »
tr 对象