title: how to call javascript function using HTML button
body: <p>i have this HTML code, how do i call a javascript function without making changes to my HTML file. </p>
  
  <pre><code>&lt;tr&gt;
       &lt;td&gt;&lt;div id="number1"&gt;1&lt;/div&gt;&lt;/td&gt;
       &lt;td&gt;&lt;div&gt;+&lt;/div&gt;&lt;/td&gt;
       &lt;td&gt;&lt;div id="number2"&gt;2&lt;/div&gt;&lt;/td&gt;
       &lt;td&gt;&lt;div&gt;=&lt;/div&gt;&lt;/td&gt;
       &lt;td&gt;&lt;input type="text"&gt;&lt;/input&gt;&lt;/td&gt;
       &lt;td&gt;&lt;input type="button" value="Check"&gt;&lt;/input&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>tried to use this javascript code but didn't work</p>
  
  <pre><code>var button = document.getElementsByTagName("input");
  button.onclick = function(){ alert('hello!'); };
  </code></pre>