Call back function, variable scope?

Discussion in 'Javascript' started by Mark Smith, May 5, 2009.

  1. Mark Smith

    Mark Smith Guest

    In the following code, should the variable e still be in scope on the
    call back function, or could it be interpreted as null?

    It seems to work in firefox, but IE gives the error "Member not found"


    function showHelp(e,t)
    {
    $.get(
    "showHelp.php",
    {topic : t},
    function(text) {
    showTooltip(e,text);
    }
    );
    }
    Mark Smith, May 5, 2009
    #1
    1. Advertising

  2. Mark Smith

    Henry Guest

    On May 5, 1:47 pm, Mark Smith wrote:
    > In the following code, should the variable e still be in
    > scope on the call back function, or could it be interpreted
    > as null?


    The outer function's formal parameter - e - will be in scope in the
    inner function (visible on the scope chain for the call to the inner
    function), and its value may be null.

    > It seems to work in firefox, but IE gives the error
    > "Member not found"

    <snip>

    In the absence of context and details the best you could expect is a
    guess. My guess is that - e - is expected to refer to an event object
    but the differences in the handling of event objects between IE and
    firefox are not being appropriately handled by the code.
    Henry, May 5, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Opal
    Replies:
    12
    Views:
    940
    Paul Opal
    Oct 11, 2004
  2. ann
    Replies:
    13
    Views:
    661
    Patricia Shanahan
    Sep 13, 2005
  3. Steven T. Hatton
    Replies:
    9
    Views:
    473
  4. David Filmer
    Replies:
    19
    Views:
    238
    Kevin Collins
    May 21, 2004
  5. Andrew Falanga
    Replies:
    2
    Views:
    198
    Andrew Falanga
    Nov 22, 2008
Loading...

Share This Page