如何禁用父窗口的焦点? [英] how to disable focus of parent window?
本文介绍了如何禁用父窗口的焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
我想打开一个弹出窗口并禁用父窗口,并且焦点应转移到弹出窗口,直到将其关闭.下面是我在父窗口上使用的代码;但是这段代码不起作用..我缺少什么吗? PLZ指南
Hi!
I want to open a popup window and disable the parent window and the focus should be shifted to pop window until it is closed. Below is the code that I am using on parent window; But this code does not work..Am i missing something? Plz guide
var popupWindow = null;
function ShowImage() {
popupWindow = window.open(''../PopOuts/QuotePicture.aspx'', ''newWin'', ''toolbar=yes,location=center, scrollbars=yes, resizable=yes, top=20, left=400 ,status=yes, width = 650, height = 400'');
}
window.onfocus = parent_disable();
window.onload = parent_disable();
function parent_disable() {
debugger;
if (popupWindow && !popupWindow.closed)
popupWindow.focus();
}
推荐答案
尝试
var popupWindow=null;
function popup()
{
popupWindow = window.open(''../PopOuts/QuotePicture.aspx'', ''newWin'', ''toolbar=yes,location=center, scrollbars=yes, resizable=yes, top=20, left=400 ,status=yes, width = 650, height = 400'');window.open(''../PopOuts/QuotePicture.aspx'',''name'',''width=200,height=200'');
}
function parent_disable() {
if(popupWindow && !popupWindow.closed)
popupWindow.focus();
}
然后在父窗口的主体标签中声明这些功能
and then declare these functions in the body tag of parent window
<body onfocus="parent_disable();" onclick="parent_disable();"></body>
这篇关于如何禁用父窗口的焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文