【问题标题】:How to open popup at right corner?如何在右上角打开弹出窗口?
【发布时间】:2011-07-13 10:52:37
【问题描述】:

我正在使用 window.open 从 javascript 打开一个弹出窗口。我想在页面的右上角打开这个弹出窗口(height="700px" width="400px")。我怎样才能做到这一点

【问题讨论】:

    标签: asp.net


    【解决方案1】:

    你可以调用如下方法:

    popUpAtMyWish("yourpage","windownamehere",500,600);
    
    
    
    function popUpAtMyWish( pageToLoad, winName, width, height)
    {
        xposition=0; yposition=0;
        if ((parseInt(navigator.appVersion) >= 4 )){
            xposition = (screen.width - width);
            yposition = (screen.height - height);
        }
    
        var args = "";
            args += "width=" + width + "," + "height=" + height + ","
            + "location=0,"
            + "menubar=0,"
            + "resizable=0,"
            + "scrollbars=0,"
            + "statusbar=false,dependent,alwaysraised,"
            + "status=false,"
            + "titlebar=no,"
            + "toolbar=0,"
            + "hotkeys=0,"
            + "screenx=" + xposition + ","  //NN Only
            + "screeny=" + yposition + ","  //NN Only
            + "left=" + xposition + ","     //IE Only
            + "top=" + yposition;           //IE Only
            var dmcaWin = window.open(pageToLoad,winName,args );
            dmcaWin.focus();
    }
    

    【讨论】:

    • 谢谢,我只是想在 javascript 中获取屏幕工作区。当我设置 window.open(...height=0) 时,它会在网络浏览器的最顶部打开弹出窗口。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-26
    • 2011-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多