<html>
<head>
<style>
table, th {
border: 1px solid black;
}
</style>
</head>
<body>
<table id="myTable">
<tr id="myTr">
</tr>
</table>
<p>Click the button to create a TH element.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var x = document.createElement("TH");
var t = document.createTextNode("table header cell");
x.appendChild(t);
document.getElementById("myTr").appendChild(x);
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_th_create by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:08:22 GMT -->
</html>