这似乎很复杂
比如Width、height函数,在IE6,IE7,FF2,FF3中的结果都不相同。
比如部分是包括窗体标题栏,有些只包括HTML显示的页面。
如果你要控制top与left。有两种办法,
在还未弹出时,就根据Width、height、window.screen.availWidth、window.screen.availHeight计算位置。
第二种就是在弹出后,使用moveTo移动窗体位置

解决方案 »

  1.   

    top=((window.screen.availHeight-document.body.clientHeight)/2);
    left=((window.screen.availWidth-document.body.clientWidth)/2);
      

  2.   


    var top = (screen.availHeight/2)-(winHeight/2);
    var left = (screen.availWidth/2)-(winWidth/2);
    window.open("","","top="+top+",left="+left);
      

  3.   

    汗~~~写错了var top = (window.screen.availHeight-document.body.clientHeight)/2);
    var left = (window.screen.availWidth-document.body.clientWidth)/2);
    window.open("","","top="+top+",left="+left);