问题描述
如果他们是一样的,那么为什么会有两种这样的事件?
If they're the same, then why there are two of this kind of event?
推荐答案
如你所知, onBlur 事件触发一个元素,如果该元素具有焦点,但失去了它。
As you know, the onBlur event fires for an element if that element had the focus, but loses it.
onFocusOut 事件在这种情况下触发,但如果任何子元素失去焦点,也会触发。
The onFocusOut event fires in this case, but also triggers if any child element loses focus.
例如,您有一个具有特殊格式的div,因为人正在编辑一个字段区。当焦点离开div时,您可以使用 onFocusOut 来关闭该格式。
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.
直到最近, onFocusOut 仅被IE使用。如果发生了变化,这是最近的。在FF,Chrome等测试。
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和onfocusout有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!