Results 1 to 2 of 2

Thread: Event Handlers in IE9

Hybrid View

  1. #1
    Join Date
    Dec 2011

    Event Handlers in IE9

    I'm practicing using Event Handlers. I'm using addEventListener() to get it done, which is working just fine in Firefox. However I can't get it to work properly in IE9. From what I understand, addEventListener() Should work in major browsers including IE9 (attachEvent() in IE 8 and below). I know I'm using IE9, and I know Javascript is turned on as well. Yet the code that works in Forefox won't work in IE9. It's a simple alert box when a <p> element is clicked.

    var para = document.getElementById("myp");
    function clickHandler1() {
    	alert("You clicked me");
    function clickHandler2() {
    	alert("You clicked me again");
    para.addEventListener("click", clickHandler1, false);
    para.addEventListener("click", clickHandler2, false);
    Just real simple code for practice. Is what I'm reading about it working in IE9 incorrect and if so, what does work in IE9 because I've also tried attachEvent() and that didn't work either. Any help is appreciated.

  2. #2
    Join Date
    Sep 2011
    Bristol, England, United Kingdom

    Works fine in all browsers. Are you using IE9 with compatibility view turned on? The little torn page icon next to the refresh button is what I'm talking about. If it's lit up blue, it's switched on.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center