title: onclick function returns undefined in IE, works fine in Chrome and Firefox
body: <p>I have a HTML page like this (simplified)</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;style&gt;
  ...
      &lt;/style&gt;
      &lt;script type ="text/javascript"&gt;
        function foo()
        {
  ...
        }
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;input type="button" value="ClickMe" onClick="foo()"/&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This works fine on Chrome, Firefox and Safari, but when I use IE, when I click, it returns 'foo' is undefined in the console logs.
  I tried moving all  section inside  but still got the same issue.
  Any hints?</p>
  
  <p>EDIT 1 : here is more of my code</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
    &lt;head&gt;
      &lt;meta content="text/html;charset=utf-8" http-equiv="Content-Type"/&gt;
      &lt;meta content="utf-8" http-equiv="encoding"/&gt;
      &lt;title&gt;My Title&lt;/title&gt;
  
      &lt;script type="text/javascript"&gt;
        function handleBrowseClick()
        {
          var fileinput = document.getElementById("browse");
          fileinput.click();
        }
  
        function handleChange()
        {
          var fileinput = document.getElementById("browse");
        }
  
        function addListener()
        {
          document.getElementById('browse').addEventListener('change', handleFileSelect, false);
        }
  
        function handleFileSelect(evt)
        {
          var files = evt.target.files;
  
          var output = [];
          for (var i=0 ; f=files[i] ; i++) {
            var reader = new FileReader();
            reader.onload = (function(theFile) {
              return function(e) {
                &lt;more JS code here&gt;
              };
            })(f);
            reader.readAsBinaryString(f);
          }
        }
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;input type="file" id="browse" name="fileupload" style="display: none" onChange="handleChange();"/&gt;
      &lt;input type="button" value="ClickMe" id="fakeBrowse" onClick="handleBrowseClick();"/&gt;
      &lt;output id="list"&gt;&lt;/output&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;script type="text/javascript"&gt;
    window.onload = addListener();
  &lt;/script&gt;
  </code></pre>