更改表格的 cellPadding 和 cellSpacing

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function padding()
  5. {
  6. document.getElementById('myTable').cellPadding="15"
  7. }
  8. function spacing()
  9. {
  10. document.getElementById('myTable').cellSpacing="15"
  11. }
  12. </script>
  13. </head>
  14. <body>
  15.  
  16. <table id="myTable" border="1">
  17. <tr>
  18. <td>100</td>
  19. <td>200</td>
  20. </tr>
  21. <tr>
  22. <td>300</td>
  23. <td>400</td>
  24. </tr>
  25. </table>
  26. <br />
  27. <input type="button" onclick="padding()" value="改变 Cellpadding">
  28. <input type="button" onclick="spacing()" value="改变 Cellspacing">
  29.  
  30. </body>
  31. </html>