title: Javascript onclick in script
body: <p>Ok im new to javascript, but I want to call an onclick function without adding onclick="function()" to the anchor tag. Here is the script I have, but I cant get it to work:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function clicka() {
   alert("hi");
  }
  document.getElementById('click').onclick = clicka;
  &lt;/script&gt;
  
  &lt;a href="#" id="click"&gt;click&lt;/a&gt;
  </code></pre>
  
  <p>When I click on the link, it should alert "hi", any ideas?</p>