删除表格中的行
- <!DOCTYPE html>
- <html>
- <body>
- <table id="myTable" style="padding:8px;border:1px solid black">
- <tr>
- <td>Bill</td>
- <td>Gates</td>
- <td>62</td>
- </tr>
- <tr>
- <td>Steve</td>
- <td>Jobs</td>
- <td>56</td>
- </tr>
- <tr>
- <td>Elon</td>
- <td>Musk</td>
- <td>47</td>
- </tr>
- </table>
- <p>
- <input type="button" value="删除一行"
- onclick="document.getElementById('myTable').deleteRow(0)">
- </p>
- </body>
- </html>