通过运行此示例:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="640" height="480"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="">
<script>
<![CDATA[
function onfocus() {
dump("FOCUSED!\n");
}
window.addEventListener("focus", onfocus, false);
]]>
</script>
<browser id="gmail" type="content" src="http://gmail.com/" flex="1" />
<button label="click here to remove the focus from the browser"/>
</window>..you可以看到,只有当window的焦点是而不是browser上的时,才会抛出焦点事件。我在底部添加了一个按钮,这样您就可以从浏览器中删除焦点,并了解我的意思:
如果
browser聚焦,则会最小化和恢复窗口,焦点事件将not发生。F 216
当browser有焦点时,我需要发生这个焦点事件,知道如何实现这个目标吗?
发布于 2011-01-22 00:41:09
尝试使用激活事件代替。
https://stackoverflow.com/questions/4763147
复制相似问题