规定表格的内部边线

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function rowRules()
  5. {
  6. document.getElementById('myTable').rules="rows"
  7. }
  8. function colRules()
  9. {
  10. document.getElementById('myTable').rules="cols"
  11. }
  12. </script>
  13. </head>
  14.  
  15. <body>
  16. <table id="myTable" border="1">
  17. <tr>
  18. <td>Row1 cell1</td>
  19. <td>Row1 cell2</td>
  20. </tr>
  21. <tr>
  22. <td>Row2 cell1</td>
  23. <td>Row2 cell2</td>
  24. </tr>
  25. <tr>
  26. <td>Row3 cell1</td>
  27. <td>Row3 cell2</td>
  28. </tr>
  29. </table>
  30. <br />
  31. <input type="button" onclick="rowRules()" value="仅显示行边框">
  32. <input type="button" onclick="colRules()" value="仅显示列边框">
  33.  
  34. </body>
  35. </html>