title: Onclick event getting called automatically
body: <p>I wrote a JavaScript class called <code>MyClass</code> in which I've defined a method <code>closeThis</code></p>
  
  <pre><code>MyClass = function() {
    this.closeThis = function() {
      document.getElementById("hidePane").style.display = 'none';
    }
  }
  </code></pre>
  
  <p>Now, in my html, i'm trying to call that as follows...</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    function callThis() {
      var myclassObj = new MyClass();
      document.getElementById("closeButton").onclick = myclassObj.closeThis();
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>The above <code>callThis</code> will be called when I clicked on a button. The problem here is, <code>onclick</code> event on top of <code>clsoeButtion</code> is getting called automatically when page loads. What could be wrong in this?</p>