本文介绍了检测iframe何时获取或失去焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检测iframe何时获取或失去焦点的正确方法(即是否将接收键盘事件)是什么?以下内容在Fx4中无效:

What's the correct way of detecting when an iframe gets or loses focus (i.e. will or will not receive keyboard events)? The following is not working in Fx4:

var iframe = /* my iframe */;
iframe.addEventListener("focus", function() { /* never gets called */ }, false);


推荐答案

原来这不是真的可能。我不得不改变我的页面的逻辑,以避免跟踪iframe的重点。

Turns out it's not really possible. I had to change the logic of my page to avoid the need of tracking if the iframe has focus.

这篇关于检测iframe何时获取或失去焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 06:26