Javascript examples for DOM HTML Element:TableHeader
TableHeader colSpan Property - Return the number of columns a specific table cell should span:
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style>// w ww. j a v a 2 s. c om </head> <body> <table> <tr> <th id="myTh" colspan="2">Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$100</td> </tr> </table> <br> <button onclick="myFunction()">Test</button> <script> function myFunction() { var v = document.getElementById("myTh").colSpan; console.log(v); } </script> </body> </html>