Connecting Tech Pros Worldwide Help | Site Map

native code attached to onblur/onfocus event handler

  #1  
Old November 19th, 2008, 11:15 AM
wolverine
Guest
 
Posts: n/a
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.
  #2  
Old November 19th, 2008, 11:35 AM
David Mark
Guest
 
Posts: n/a

re: native code attached to onblur/onfocus event handler


On Nov 19, 6:12*am, wolverine <kiran.ha...@gmail.comwrote:
Quote:
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.
Quote:
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.
Quote:
>
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;"?
Quote:
>
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.
  #3  
Old November 20th, 2008, 02:15 PM
wolverine
Guest
 
Posts: n/a

re: native code attached to onblur/onfocus event handler


On Nov 19, 4:29*pm, David Mark <dmark.cins...@gmail.comwrote:
Quote:
On Nov 19, 6:12*am, wolverine <kiran.ha...@gmail.comwrote:
>
Quote:
Hi All,
>
Quote:
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.
>
Quote:
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.
>
>
>
Quote:
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;"?
>
>
>
Quote:
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.
Closed Thread