解决方案:将侦听器添加到所有帧
<head> ... <script type="text/javascript"> onBlur=function(event) { window.focusFlag = false; }; onFocus=function(event){ window.focusFlag = true; }; function createFocusListeners() { window.focusFlag = true; if (false) { // check for Internet Explorer document.onfocusin = onFocus; document.onfocusout = onBlur; } else if (typeof window.addEventListener != "undefined"){ document.getElementById('topframe').contentWindow.addEventListener('focus',onFocus, false); document.getElementById('topframe').contentWindow.addEventListener('blur',onBlur, false); document.getElementById('leftframe').contentWindow.addEventListener('focus',onFocus, false); document.getElementById('leftframe').contentWindow.addEventListener('blur',onBlur, false); document.getElementById('mainframe').contentWindow.addEventListener('focus',onFocus, false); document.getElementById('mainframe').contentWindow.addEventListener('blur',onBlur, false); window.addEventListener('focus',onFocus, false); window.addEventListener('blur',onBlur, false); } }; //main frame is constantly reloaded, must add listener after each reload window.createMainframeFocusListeners = (function () { if (typeof window.addEventListener != "undefined"){ document.getElementById('mainframe').contentWindow.addEventListener('focus',onFocus, false); document.getElementById('mainframe').contentWindow.addEventListener('blur',onBlur, false); } }); </script></head><frameset rows="32,*" cols="*" onload="createFocusListeners();"> <frame id="topframe" src="Menuframe.jspx" name="topframe" scrolling="NO" noresize="noresize"/> <frameset rows="*" cols="280,*"> <frame id="leftframe" src="Treeframe.jspx" name="leftframe" scrolling="NO"/> <frame id="mainframe" src="ListView.jspx" name="mainframe" scrolling="NO"/> </frameset></frameset>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)