javascript table delete

it2022-05-09  24

<html> <head> <script type="text/javascript"> function deleteRow(i){     document.getElementById('myTable').deleteRow(i) } </script> </head> <body> <table id="myTable" border="1"> <tr>   <td>Row 1</td>   <td><input type="button" value="Delete" οnclick="deleteRow(this.parentNode.parentNode.rowIndex)" /></td> </tr> <tr>   <td>Row 2</td>   <td><input type="button" value="Delete" οnclick="deleteRow(this.parentNode.parentNode.rowIndex)" /></td> </tr> <tr>   <td>Row 3</td>   <td><input type="button" value="Delete" οnclick="deleteRow(this.parentNode.parentNode.rowIndex)" /></td> </tr> </table> </body></html>

转载于:https://www.cnblogs.com/nanshouyong326/archive/2008/12/11/1353015.html


最新回复(0)