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. Advertisements

  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. Advertisements

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. grbgooglefan
    Replies:
    2
    Views:
    629
    Pascal Bourguignon
    Jan 30, 2008
  2. grbgooglefan
    Replies:
    4
    Views:
    650
    Kenny McCormack
    Jan 30, 2008
  3. grbgooglefan
    Replies:
    0
    Views:
    559
    grbgooglefan
    Jan 30, 2008
  4. AikidoGuy
    Replies:
    11
    Views:
    782
    Seebs
    Nov 21, 2011
  5. Alok
    Replies:
    3
    Views:
    472
  6. THAKUR PRASHANT SINGH

    Class Function call vs Normal Function call

    THAKUR PRASHANT SINGH, Feb 26, 2010, in forum: Ruby
    Replies:
    7
    Views:
    443
    THAKUR PRASHANT SINGH
    Feb 27, 2010
  7. David Filmer
    Replies:
    19
    Views:
    502
    Kevin Collins
    May 21, 2004
  8. Andrew Falanga
    Replies:
    2
    Views:
    374
    Andrew Falanga
    Nov 22, 2008
Loading...