title: IE9 onclick Bug?
body: <pre><code>this.fillSelectBox  = function (flowCounterObj)
  {
      while (this.selectBox.hasChildNodes())
      {
          this.selectBox.removeChild(this.selectBox.firstChild);
      }
      var line = 0;
      for(line = 0; line &lt; this.lines.length; line++)
      {
          var newOption = document.createElement('option');
          newOption.setAttribute('value','line_' + line);
          newOption.innerHTML = 'Line ' + line;
          newOption.onclick = function(){flowCounterObj.setCurrentLine(this.index);};
          this.selectBox.appendChild(newOption);
      }
  };
  </code></pre>
  
  <p>The above code removes all options from the select box and the creates a new option for each line I have in my array.</p>
  
  <p>It adds a event to the onclick.</p>
  
  <p>When I select my options in Chrome they call the setCurrentLine() function.  However in IE9 it doesn't.</p>
  
  <p>I have looked at the debugging windows in both IE9 and Chrome and they apply the same stuff.</p>
  
  <p>I have tried using <code>setAttribute('onclick',flowCounter.setCurrentLine('+line+');');</code> but that doesn't work either in IE9 (does in Chrome);</p>
  
  <p>I have also tried using <code>addEventListener(...);</code> but that doesn't work in IE9 (does in Chrome).</p>
  
  <p>(On a side note should I actually be using addEventListener for this? Is that the correct way?)</p>
  
  <p>I put the code through JS lint and it says I shouldn't create functions in loops?</p>
  
  <p>Any ideas? Do you think this could actually be a bug?</p>
  
  <p>Matt</p>
  
  <p><strong>EDIT</strong>:  I tried the following HTML code in IE9:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;select id='lineSelect' size='4'&gt;
          &lt;option value='line_1' onclick='alert("whoop");'&gt;Line 1&lt;/option&gt;
          &lt;option value='line_2' onclick='alert("whoop");'&gt;Line 2&lt;/option&gt;
          &lt;option value='line_3' onclick='alert("whoop");'&gt;Line 3&lt;/option&gt;
          &lt;option value='line_4' onclick='alert("whoop");'&gt;Line 4&lt;/option&gt;
      &lt;/select&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And that doesn't do anything?  Does in chrome/safari/firefox/opera! Also did it with onClick/onChange.</p>