W3Schools.com

tr sectionRowIndex Property

tr Object Reference tr Object

Definition and Usage

The sectionRowIndex property returns the position of a row in the rows collection of a tbody, thead, or tfoot.

Syntax

Return the sectionRowIndex property:

trObject.sectionRowIndex

Tip: There is no default value for the sectionRowIndex property.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The sectionRowIndex property is supported in all major browsers.


Example

Example

Alert the position of the rows in the thead, tbody, and tfoot rows collection:

<html>
<head>
<script type="text/javascript">
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>

Try it yourself »


tr Object Reference tr Object
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE