Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Tuesday, May 1, 2012
In web browser, what"s the difference between onblur and onfocusout?
If it is the same, then why there are two of this kind of event.
As you know, the onBlur event fires for an element if that element had the focus, but loses it.
The onFocusOut event fires in this case, but also triggers if any child element loses focus.
For example, you have a div with special formatting because the human is currently editing a field in that area. You'd could use onFocusOut to turn that formatting off when focus leaves that div.
Up until very recently, onFocusOut was only used by IE. If that has changed, it has been very recent. Test in FF, Chrome, etc.
The onfocusout event is a non-standard event that works only in Internet Explorer, while the onblur event is part of the W3C standards and works in every modern browser.
As you know, the onBlur event fires for an element if that element had the focus, but loses it.
ReplyDeleteThe onFocusOut event fires in this case, but also triggers if any child element loses focus.
For example, you have a div with special formatting because the human is currently editing a field in that area. You'd could use onFocusOut to turn that formatting off when focus leaves that div.
Up until very recently, onFocusOut was only used by IE. If that has changed, it has been very recent. Test in FF, Chrome, etc.
"..onblur occurs before the element loses focus, and onfocusout occurs after it has lost focus, and another element has gained focus..."
ReplyDeletesource: tek-tips
The onfocusout event is a non-standard event that works only in Internet Explorer, while the onblur event is part of the W3C standards and works in every modern browser.
ReplyDelete