Javascript examples for DOM HTML Element:TableData
TableData headers Property - Change the value of the headers attribute of a <td> element with id "myTd":
<!DOCTYPE html> <html> <head> <style> table {/*from ww w . j a va2 s. com*/ width: 100%; } table, th, td { border: 1px solid black; } </style> </head> <body> <table> <tr> <th id="name">Name</th> <th id="email">Email</th> <th id="phone">Phone</th> <th id="addr">Address</th> </tr> <tr> <td id="myTd" headers="name">your name</td> <td headers="email">someone@example.com</td> <td headers="phone">+123456789</td> <td headers="addr">Main Street</td> </tr> </table> <br> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myTd").headers = "newValue"; document.getElementById("demo").innerHTML = "changed"; } </script> </body> </html>