title: How to addHandler with parameter?
body: <p>If i try to pass parameter like:  this._Click(i) I get error.</p>
  
  <pre><code> BBtor = function(element) {
  //some code
  
  }   
   BBtor.prototype = {
  
  
      initialize: function() {
        for (var i = 0; i &lt; 3; i++) {
         $addHandler($get("Button"+i),'mouseup' , this._Click(i));
        }
      },
  
      _Click: function(param) {
             alert(param);
      }
  }
  </code></pre>
  
  <p>The error I get:</p>
  
  <blockquote>
    <p>Microsoft JScript runtime error:
    Sys.ArgumentUndefinedException: Value
    cannot be undefined. Parameter name:
    handler</p>
  </blockquote>
  
  <p>Again. if run this (without parameter), it works:</p>
  
  <pre><code> $addHandler($get("Button"+i),'mouseup' , this._Click);
  </code></pre>
  
  <p>if I try this:</p>
  
  <pre><code> $addHandler($get("Button"+i),'mouseup' , this._Click(i));
  </code></pre>
  
  <p>it's not working.</p>
  
  <hr>
  
  <p>This worked for me:</p>
  
  <pre><code>$addHandler($get("Button"+i),'mouseup' , function(xx) { return function() { that._Click(xx) } } (i)); 
  </code></pre>
  
  <p>But with that I got another problem. how to remove the handler in dispose function? </p>
  
  <pre><code>dispose: function() {             
        for (var i = 0; i &lt; 3; i++) {
       var that = this;
           $removeHandler($get("Button"+i),'mouseup' , function(xx) { return function() { that._Click(xx) } } (i));          
  
      },
  </code></pre>
  
  <p>I get error:</p>
  
  <blockquote>
    <p>Microsoft JScript runtime error:
    Sys.InvalidOperationException: Handler
    was not added through the
    Sys.UI.DomEvent.addHandler method.</p>
  </blockquote>
  
  <p>Anyway, is it important to remove click events from the buttons?</p>