title: Redirecting using JS file instead of HTML event handler?
body: <p>So currently I want to have my javascript in an attached JS file instead of using the 'OnClick' function attached to HTML objects. So far I've got: </p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;       
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1 id = '5' class = ''&gt;6&lt;/h1&gt;
          &lt;button id = '7' class = ''&gt;8&lt;/button&gt;
          &lt;script src = 'js/9.js'&gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>But unfortunately, I can't quite get the redirect going from clicking the button. It should have this source</p>
  
  <pre><code>document.getElementById('7').onclick = function () {
  </code></pre>
  
  <p>and then redirecting to a different page. Any tips on how I can improve this?</p>