编辑下面的代码:【加编码】
<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>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂