运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> table, td { border: 1px solid black; } </style> </head> <body> <p>Click on each tr element to alert the position of the rows in the thead, tbody and tfoot rows collection.</p> <table> <thead> <tr onclick="myFunction(this)"> <th>Click to show sectionRowIndex</th> </tr> <tr onclick="myFunction(this)"> <th>Click to show sectionRowIndex</th> </tr> </thead> <tbody> <tr onclick="myFunction(this)"> <td>Click to show sectionRowIndex</td> </tr> <tr onclick="myFunction(this)"> <td>Click to show sectionRowIndex</td> </tr> </tbody> <tfoot> <tr onclick="myFunction(this)"> <td>Click to show sectionRowIndex</td> </tr> <tr onclick="myFunction(this)"> <td>Click to show sectionRowIndex</td> </tr> </tfoot> </table> <script> function myFunction(x) { alert("Section row index is: " + x.sectionRowIndex); } </script> </body> </html>