改变表格的内边距
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- function padding(id) {
- document.getElementById(id).style.padding = "15px";
- }
- </script>
- </head>
- <body>
- <table id="myTable" style="border:1px solid black">
- <tr>
- <td>100</td>
- <td>200</td>
- </tr>
- <tr>
- <td>300</td>
- <td>400</td>
- </tr>
- </table>
- <p>
- <input type="button" onclick="padding('myTable')" value="更改内边距">
- </p>
- </body>
- </html>