The problem with your script, as pointed out in the comments, is that you are never invoking initTH()
, so the button click handler is never getting attached to the button.
What the comments fail to note is that you have your script placed before the HTML. In particular, it comes before <input id="calcButton" type="button" value="calculate" />
, meaning that if you're not careful when you call document.getElementById("calcButton")
, that will return null
.
It sounds like what you want to do is add an additional <script>
element at the end of the body (right before the close </body>
tag) and invoke initTH()
:
....
<script>
initTH();
</script>
</body>