native code attached to onblur/onfocus event handler

Discussion in 'Javascript' started by wolverine, Nov 19, 2008.

  1. wolverine

    wolverine Guest

    Hi All,

    In Mozilla Firefox, to onblur and onfocus event of each and every
    html element, the browser itself will attach a native event handler. I
    mean if you type, 'javascript:alert(window.blur)' in the address bar
    of Firefox browser, you can see a 'function ....' . That is a Firefox
    browser defined handler.

    Now assume that web developer also attach event handlers to 'onblur'
    events eg: 'window.blur=f3()'

    Is there any way to check if the event handler is a browser attached
    handler OR a web developer attached event handler ?

    Regards,
    Kiran.
    wolverine, Nov 19, 2008
    #1
    1. Advertising

  2. wolverine

    David Mark Guest

    On Nov 19, 6:12 am, wolverine <> wrote:
    > Hi All,
    >
    > In Mozilla Firefox,  to onblur and onfocus event of each and every
    > html element, the browser itself will attach a native event handler. I


    Do tell.

    > mean if you type, 'javascript:alert(window.blur)' in the address bar
    > of Firefox browser, you can see a 'function ....' . That is a Firefox
    > browser defined handler.


    Is it? Not unexpectedly, IE shows the same thing.

    >
    > Now assume that web developer also attach event handlers to 'onblur'
    > events eg: 'window.blur=f3()'


    That is not an event handler (or even a known property) and unless f3
    is a factory function, the right side is wrong too. Perhaps you meant
    "window.onblur = f3;"?

    >
    > Is there any way to check if the event handler is a browser attached
    > handler OR a web developer attached event handler ?


    In other words, you want to know if a property (e.g. onblur) of an
    element has been set by another script? There is no standard way to
    do this. If you need to support just a few browsers and they all
    return the same toString results, then you could look for the string
    you saw in the alert. Better yet, figure out a way to factor this
    decision out of the system.
    David Mark, Nov 19, 2008
    #2
    1. Advertising

  3. wolverine

    wolverine Guest

    On Nov 19, 4:29 pm, David Mark <> wrote:
    > On Nov 19, 6:12 am, wolverine <> wrote:
    >
    > > Hi All,

    >
    > > In Mozilla Firefox,  to onblur and onfocus event of each and every
    > > html element, the browser itself will attach a native event handler. I

    >
    > Do tell.
    >
    > > mean if you type, 'javascript:alert(window.blur)' in the address bar
    > > of Firefox browser, you can see a 'function ....' . That is a Firefox
    > > browser defined handler.

    >
    > Is it?  Not unexpectedly, IE shows the same thing.
    >
    >
    >
    > > Now assume that web developer also attach event handlers to 'onblur'
    > > events eg: 'window.blur=f3()'

    >
    > That is not an event handler (or even a known property) and unless f3
    > is a factory function, the right side is wrong too.  Perhaps you meant
    > "window.onblur = f3;"?
    >
    >
    >
    > > Is there any way to check if the event handler is a browser attached
    > > handler OR a web developer attached event handler ?

    >
    > In other words, you want to know if a property (e.g. onblur) of an
    > element has been set by another script?  There is no standard way to
    > do this.  If you need to support just a few browsers and they all
    > return the same toString results, then you could look for the string
    > you saw in the alert.  Better yet, figure out a way to factor this
    > decision out of the system.


    Thanks a lot.

    Sorry for posting that stupid a question in the groups. I was confused
    and thought 'window.blur' is a event handler for 'blur' event on
    window.
    wolverine, Nov 20, 2008
    #3
    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. Replies:
    2
    Views:
    1,002
  2. Jim

    Catch OnFocus and OnBlur of an ASP.NET Label

    Jim, Jan 22, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    280
    Chris
    Feb 15, 2005
  3. Tzachi

    onfocus, onblur on dynamic input box.

    Tzachi, Sep 19, 2004, in forum: Javascript
    Replies:
    1
    Views:
    226
    Michael Winter
    Sep 19, 2004
  4. the good guy

    onFocus/onBlur

    the good guy, Mar 31, 2005, in forum: Javascript
    Replies:
    3
    Views:
    107
    kaeli
    Apr 1, 2005
  5. Nebulus
    Replies:
    4
    Views:
    107
    Nebulus
    May 19, 2006
Loading...

Share This Page