Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <p>Click the button to return the value of the colspan attribute of th with id "myTh".</p> <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()">Try it</button> <p id="demo"></p> <script> function myFunction(x) { var x = document.getElementById("myTh").colSpan; document.getElementById("demo").innerHTML = "The value of colspan is: " + x; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_th_colspan by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:35:12 GMT --> </html>
Result:
Try it Yourself - © w3schools.com