<script language="javascript">
function newWind()
{
var x = window.screen.width;
var y = window.screen.height;
x =(x - 300) / 2;
y =(y - 250) / 2;
window.open("1.html",'',"top=" + y + ",left=" + x);
}
</script>

解决方案 »

  1.   

    x =(x - 300) / 2 ,  y =(y - 250) / 2 为什么要 -300  和 -250 
    另外,我如果要打开指定宽,高的页面,应该怎么改哪window.open('1.html','','top=' + y + ',left=' + x+',width=400,height=400');
      

  2.   

    function xtop(height)
    {
    var xtop = window.screen.height;
    xtop =(xtop - height) / 2;
    }function yleft(width)
    {
    var yleft = window.screen.width;
    yleft =(yleft - width) / 2;}window.open ('1.html','','top='+xtop(400)+',left='+yleft(600)+',width=600,height=400,resizable=no,scrollbars=auto')我这样改为什么新窗体还在不居中,总帖在在左上角? 哪里出问题了
      

  3.   

    汗ing.............. 丢了retuen 语句,多谢帮助,结贴