2011-09-28 53 views
0

嗨,有人能告訴我如何在gwt中做如下的事情嗎?如何獲取gwt中彈出窗口的句柄?

test(){ 
    var win = 
    window.open("http://www.stackoverflow.com", 
       "mywindow", 
       "location=1,status=1,scrollbars=1,width=100,height=100"); 
    win.location = "http://www.yahoo.com"; 
} 

回答

0

好的,再試一次。

關閉我的頭頂,使用PopupPanel或該Widget的一些子類。然後你有一個「處理」它。在面板中插入一個Frame小部件,並將Frame的URL設置爲您需要的外部站點。使用PopupPanel類提供的方法處理大小調整和其他方面。

http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/PopupPanel.html

http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/Frame.html

0

你可以通過創建一個overlay type操縱window手柄:

public class MyWindow extends JavaScriptObject { 
    protected MyWindow() { 
    } 

    public static native MyWindow open(String url, String name) /*-{ 
    return $wnd.open(url, name); 
    }-*/; 

    public static native MyWindow open(String url, String name, String options) /*-{ 
    return $wnd.open(url, name, options); 
    }-*/; 

    public native void setHref(String href) /*-{ 
    if (this.location) { 
     this.location.href = href; 
    } 
    }-*/; 
} 

注意,一旦窗口原點的變化,你將不再能夠操縱窗口。