Adding event on check box not working in internet explorer
<p>I have added some check boxes dynamically and add event on checkboxes. In firefox  it is ok but in IE this is not working </p>

<pre><code>function addDynamicCheckBox(){
        var i=0;
        for(i=0;i&lt;solarPanelId.length;i++){
            var cb = document.createElement( "input" );
            cb.type = "checkbox";
            cb.id = "id"+i;
            cb.value = i;
            boxArray[i]=cb;
            cb.checked="true";
            addEvent(cb, "click", addOrRemoveLine );
            var text = document.createTextNode( "Solar Panel"+" "+(i+1));
            document.getElementById( 'visualization' ).appendChild( text );
            document.getElementById( 'visualization' ).appendChild( cb );
       }
  }
    function addEvent(obj, type, fn) 
       {
          if (obj.attachEvent) 
           {
               obj['e' + type + fn] = fn;
               obj[type + fn] = function(){obj['e' + type + fn](window.event);}
               obj.attachEvent('on' + type, obj[type + fn]);
           } 
           else
               obj.addEventListener(type, fn, false);
       }
</code></pre>

<p>thanks in advance</p>
