Result Size: 625 x 664
x
 
<!DOCTYPE html>
<html>
<head>
<style>
table, td {
  border: 1px solid black;
}
</style>
</head>
<body>
<table>
  <tr>
    <td>Row 1</td>
  </tr>
  <tr>
    <td>Row 2</td>
  </tr>
  <tr>
    <td>Row 3</td>
  </tr>
</table>
<p>Click the button to return the position of each row in the table.</p>
<p id="demo"></p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
  var x = document.getElementsByTagName("tr");
  var txt = "";
  var i;
  for (i = 0; i < x.length;i++) {
    txt = txt + "The index of Row "+(i+1)+" is: "+x[i].rowIndex+"<br>";
  }
  document.getElementById("demo").innerHTML = txt;
}
</script>
</body>
</html>