Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts

    getting addEventListener working in ie.

    hey everyone.
    http://rob.lemon.googlepages.com/rlt...tionModel.html
    That is the sample page i'm working with.
    i started just registering click events, then when i remembered IE does not support addEventListener i decided it would be 'easier' too just add it in.

    And so this code came too be

    Code:
        if (!window.addEventListener)
        {
            Object.prototype.addEventListener = function(eventName, func, capture)
            {
                if (window.attachEvent)
                {
                        window.attachEvent('on' + eventName, func);
                }
            window.addEventListener = Object.prototype.addEventListener;
        }
    I do not receive an error, but I do not hit the event handler.

    any ideas where i've went wrong?
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    in that code you're missing a closing }...

  • #3
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by GJay View Post
    in that code you're missing a closing }...
    Code:
    if(!document.addEventListener)
    {
    Object.prototype.addEventListener = function(eN, F)
    {
    if(this.attachEvent)
    {
    this.attachEvent('on' + eN, F);
    }
    }
    document.addEventListener = Object.prototype.addEventListener;
    }
    works now. i had to add the method to the document object instead of window. worked fine after that.
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<


  •  

    Posting Permissions

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