2009-09-29 75 views
0

看起来很简单,但我没有找到办法。 我打开了一扇窗:专注于window.open和当前窗口

一个。我需要的是尽量减少打开窗口。 b。当完成加载时,我需要进行标准化,然后专注于父窗口。

--Code

var openwindow = null; 

$(function(){ 

    openwindow = window.open("http://www.domine.com", "winx", "width=200,height=30,toolbar=0,location=0,status=0,scrollbars=0,menubar=0,directories=0,resizable=0"); 

    //minimized -> openwindow 

    $(openwindow).load(function(){ 
     //normalized -> openwindow 
     ... 
     //focus in current window 
    }); 
}); 

感谢

回答

0

首先,在一个非常小的尺寸打开弹出式窗口,然后在弹出的窗口:

在负载完成:

window.resizeTo(screen.width,screen.height); //this would maximize it, set the numbers to 200,30 to match your requirement 
window.parent.opener.focus(); 
+0

的问题是,我拥有了新的窗口 – 2009-09-29 21:39:29

+0

可以调整从父弹出无法控制的,但你将有当它完成加载,然后在没有控制。 openwindow.resizeTo(winWidth,winHeight); – Mohammad 2009-09-29 22:11:32

0

在子窗口的onload事件中,您可以拨打window.opener.focus()window.opener.document.focus()重新关注父级。但我不确定是否有任何方法可以最小化子窗口,而加载