[JavaScript] 通过JS代码为表格动态添加标题caption →→→→→进入此内容的聊天室

来自 , 2019-02-04, 写在 JavaScript, 查看 129 次.
URL http://www.code666.cn/view/894a9b94
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function createCaption()
  6. {
  7. var x=document.getElementById('myTable').createCaption();
  8. x.innerHTML="My table caption";
  9. }
  10. </script>
  11. </head>
  12. <body>
  13.  
  14. <table id="myTable" border="1">
  15. <tr>
  16. <td>Row1 cell1</td>
  17. <td>Row1 cell2</td>
  18. </tr>
  19. <tr>
  20. <td>Row2 cell1</td>
  21. <td>Row2 cell2</td>
  22. </tr>
  23. </table>
  24. <br>
  25. <input type="button" onclick="createCaption()" value="Create caption">
  26.  
  27. </body>
  28. </html>
  29.  
  30. //javascript/7987

回复 "通过JS代码为表格动态添加标题caption"

这儿你可以回复上面这条便签

captcha