Javascript window.open让窗口居中的代码

    function OpenEnvDefineWin()
    {
        
var width = 400;
        
var height = 300;
        
var left = eval(screen.width - width) / 2;
        
var top = eval(screen.height - height) / 2;
        
var open_feature = "width=" + width + ", height=" + height + ", left=" + left + ", top=" + top + ", scrollbar=no";
        
var hwnd = window.open("popup.html""_blank", open_feature);
        
if ((window != null&& (!hwnd.opener))
            hwnd.opener 
= window;
        hwnd.focus();
        
return false;
    }
posted @ 2011-03-20 14:04  super119  阅读(406)  评论(0编辑  收藏  举报