<html> <head> <script type="text/javascript"> function alertRowIndex() { alert(document.getElementById("tr4").parentNode.innerHTML); alert(document.getElementById("tr4").rowIndex); } function addRow() { var tr3=document.getElementById("tr3"); var tr4=tr3.cloneNode(true); tr4.id="tr4"; tr3.parentNode.appendChild(tr4); } </script> </head> <body> <table border="1"> <tr id="tr1"> <th>Firstname</th> <th>Lastname</th> </tr> <tr id="tr2"> <td>Peter</td> <td>Griffin</td> </tr> <tr id="tr3"> <td>Peter</td> <td>Griffin</td> </tr> </table> <br /> <input type="button" onclick="alertRowIndex()" value="Alert row index" /> <input type="button" onclick="addRow()" value="Add new row" /> </body> </html>