Javascript examples for DOM HTML Element:TableHeader
The TableHeader object represents an HTML <th> element.
You can access a <th> element by using getElementById():
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style>// w w w . j a va2 s . c om </head> <body> <table> <tr> <th id="myTh">Name</th> </tr> <tr> <td>John</td> </tr> </table> <button onclick="myFunction()">change the text of the TH element</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myTh"); x.innerHTML = "New Table Header"; } </script> </body> </html>