title: Problem with Event Listeners
body: <p>In my attempt to learn core JavaScript, I am now learning about EventListeners.</p>
  
  <p>My problem is that in code below EventListener not being fired in IE (working just fine in Firefox and Chrome).</p>
  
  <p>Can somebody please tell me what I am doing wrong?</p>
  
  <p>My code is:</p>
  
  <pre><code>&lt;p&gt;The first captain of the USS Enterprise NCC-1701 was
              &lt;a id="wikipedia" href="http://en.wikipedia.org"&gt;Christopher Pike&lt;/a&gt;.
          &lt;/p&gt;
  
          &lt;script type="application/javascript"&gt;
  
                  var link = document.getElementById("wikipedia");
                  // for firefox and other browsers
                  if (typeof link.addEventListener != "undefined")
                  {
                      link.addEventListener("click", clickListener, false);
                  }
                  // IE only
                  else if (typeof link.attachEvent != "undefined")
                  {
                      link.attachEvent("onclick", clickListener);
                  }
  
                  function clickListener()
                  {
                      var link = document.getElementById("wikipedia");
                      link.setAttribute("href", "www.mysite.com/");
                      open("http://www.mysite.com");
                      return false;
                  }
          &lt;/script&gt;
  </code></pre>