title: Javascript's object.onClick runs the function instead of setting onClick, how can I prevent that from happening and only execute the function onClick?
body: <p>I have the following code:</p>
  
  <pre><code>function sdefaults()
  {
     alert("test");
  }
  
  var btnpos, sbtn;
  btnpos = document.getElementsByName('somePosition')[0];
  sbtn = document.createElement('input');
  btnpos.parentNode.insertBefore(sbtn, btnpos.nextSibling);
  sbtn.type = "button";
  sbtn.name = "social";
  sbtn.value = "Defaults";
  sbtn.onClick = sdefaults();
  </code></pre>
  
  <p>The button appears where I want it to and the name/value are set correctly.  However when I load the page, the <code>sdefaults()</code> function is run and then if I click the button, nothing happens.  Could anyone provide any insight into how to prevent the function from running on load and force it to only run onclick?</p>
  
  <p>Thanks</p>