title: Javascript addEventListener onStateChange not working in IE
body: <p>I have two colorbox popup boxes which show a YouTube video in each. When they're finished playing, I'm trying to have them automatically close the colorbox window. This code below works perfect in Firefox, but in IE I can't get <code>addEventListener</code> to work. I've tried <code>attachEvent </code>with no success. Can anybody offer any suggestions as to how to solve this? It seems simple but I'm exhausted trying to find a solution.</p>
  <p>UPDATE 1:</p>
  <p>Well, this is my current code. It works perfect in Firefox, but IE only outputs good. IE8 debugger doesn't report any errors either...</p>
  <pre><code>function onYouTubePlayerReady(playerId) {
    if (playerId &amp;&amp; playerId != 'undefined') {
      if(playerId &amp;&amp; playerId == 'ytvideo1'){
        var ytswf = document.getElementById('ytplayer1');
        alert('good');
      } else if(playerId &amp;&amp; playerId == 'ytvideo2'){
        var ytswf = document.getElementById('ytplayer2');
      } else {
      }
  
      setInterval('', 1000);
      ytswf.addEventListener('onStateChange', 'onytplayerStateChange');
      alert('great');
    }
  }
  
  
  function onytplayerStateChange(newState) {
    alert('amazing');
    if(newState == 0){
      $.fn.colorbox.close();
      alert('perfect');
    }
  }
  </code></pre>
  <p>Update 3: Solution</p>
  <p>Simply put onComplete in my colorbox and put the swfobject in that and it worked perfectly in IE.</p>