Javascript 是否使用全屏闪烁控件检测window.onfocus?
我有一个flash对象,它占据了我网站的整个浏览器。我正在尝试检测浏览器是否处于焦点位置。最好的方法是什么?使用onfocus/onblur在FireFox中有效,但在IE6或IE7中不起作用Javascript 是否使用全屏闪烁控件检测window.onfocus?,javascript,internet-explorer,Javascript,Internet Explorer,我有一个flash对象,它占据了我网站的整个浏览器。我正在尝试检测浏览器是否处于焦点位置。最好的方法是什么?使用onfocus/onblur在FireFox中有效,但在IE6或IE7中不起作用 window.onblur = function() { document.title = "NOT focused"; } window.onfocus = function() { document.title = "focused" } 如果我删除flash对象,看起来这在IE6/7中也可
window.onblur = function() {
document.title = "NOT focused";
}
window.onfocus = function() {
document.title = "focused"
}
如果我删除flash对象,看起来这在IE6/7中也可以使用,但这不是我的选择。谢谢 在AS3中,您可以向阶段添加事件侦听器:
if (/*@cc_on!@*/false) { // check for Internet Explorer
document.onfocusin = function(){document.title = "focused";}
document.onfocusout = function(){document.title = "NOT focused";}
} else {
window.onfocus = function(){document.title = "focused";}
window.onblur = function(){document.title = "NOT focused";}
}
stage.addEventListener(Event.DEACTIVATE, windowNotActiveCallback);
stage.addEventListener(Event.ACTIVATE, windowActiveCallback);
这仍然有一些失火时,进出标签,但肯定比我有更好的!