Dynamically add caption to the table through JS code

From , 5 Years ago, written in JavaScript, viewed 135 times.
URL https://pastebin.vip/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

Reply to "Dynamically add caption to the table through JS code"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website