- 主题:求指点:如何捕获IE窗口失去焦点的事件呢?
项目里要实现一种效果,在IE窗口失去焦点的时候,要给用户一些提示。
我用了window.onblur,在Firefox下运行得挺好的,但在IE上,有的时候IE窗口尚未失去焦点,也会触发这个事件。
google了一下,也没找到好的办法。只是提到说,IE的window.onblur事件在某些情况下会跟随着onfocus触发。
大家对此有啥办法不?
--
FROM 218.241.130.*
w3中说道:
In an HTML document, an element must receive focus from the user in order to become active and perform its tasks. For example, users must activate a link specified by the A element in order to follow the specified link. Similarly, users must give a TEXTAREA focus in order to enter text into it.
又说:
Navigate from one element to the next with the keyboard. The document's author may define a tabbing order that specifies the order in which elements will receive focus if the user navigates the document with the keyboard (see tabbing navigation). Once selected, an element may be activated by some other key sequence.
最后又提到:
The following elements support the tabindex attribute: A, AREA, BUTTON, INPUT, OBJECT, SELECT, and TEXTAREA.
从我的观点理解为:blur前提必须focus,既然W3无明确规定window是否可以focus,
则各浏览器可以自行实现。blur也按此理解吧。
【 在 heing (add oil) 的大作中提到: 】
: 项目里要实现一种效果,在IE窗口失去焦点的时候,要给用户一些提示。
: 我用了window.onblur,在Firefox下运行得挺好的,但在IE上,有的时候IE窗口尚未失去焦点,也会触发这个事件。
: google了一下,也没找到好的办法。只是提到说,IE的window.onblur事件在某些情况下会跟随着onfocus触发。
: ...................
--
FROM 123.113.100.*
就是说当用户不再关注时,强行把用户再拉回来?
【 在 heing (add oil) 的大作中提到: 】
: 项目里要实现一种效果,在IE窗口失去焦点的时候,要给用户一些提示。
: 我用了window.onblur,在Firefox下运行得挺好的,但在IE上,有的时候IE窗口尚未失去焦点,也会触发这个事件。
: google了一下,也没找到好的办法。只是提到说,IE的window.onblur事件在某些情况下会跟随着onfocus触发。
: ...................
--
FROM 202.106.68.*
不是,只是要实现以下功能:
当窗口失去焦点的时候,如果页面发生了变化,则提示用户,例如标题闪烁之类。
【 在 sayinger (言者) 的大作中提到: 】
: 就是说当用户不再关注时,强行把用户再拉回来?
--
FROM 218.241.130.*
这个不用你操心,你只管改页面标题就行了
【 在 heing (add oil) 的大作中提到: 】
: 不是,只是要实现以下功能:
: 当窗口失去焦点的时候,如果页面发生了变化,则提示用户,例如标题闪烁之类。
--
FROM 202.106.68.*
当页面没有失去焦点的时候,不需要改标题。所以我得知道啥时候页面失去了焦点,啥时候获取了焦点。
【 在 sayinger (言者) 的大作中提到: 】
: 这个不用你操心,你只管改页面标题就行了
--
FROM 218.241.130.*
ie下用document的onfocusout
【 在 heing (add oil) 的大作中提到: 】
: 当页面没有失去焦点的时候,不需要改标题。所以我得知道啥时候页面失去了焦点,啥时候获取了焦点。
--
FROM 202.106.68.*
cool~~
多谢!
【 在 sayinger (言者) 的大作中提到: 】
: ie下用document的onfocusout
--
FROM 218.241.130.*