title: AppendChild Link with onClick function
body: <p>I'm trying to use appendChild within Javascript to create a link that has a onClick attribute. I can't seem to make it work or find how to do this simple task.</p>
  
  <pre><code>var link=document.createElement("a");
  link.appendChild(document.createTextNode("Link"));
  link.href = '#';
  link.onclick = 'loadScript()';
  document.body.appendChild(link);
  </code></pre>