window.open 的参数里只有设置左右边距,但显示器不同分辨率就不同,不能设死。请问,有其他方法吗?

解决方案 »

  1.   

    先用取得显示器的分辨率
    window.open 的参数用变量呀
      

  2.   


    <script>
    function openwin(){
    var width=Math.round((window.screen.width-400)/2);
    var height=Math.round((window.screen.height-200)/2);
    window.open('http://www.baidu.com', 'newwindow', 'height=200, width=400, top='+height+',left='+width+',toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
    }
    </script>
    <a href="javascript:void(0)" onclick="openwin();">同意交换</a>
      

  3.   

    直接写在链接里
    <a href="javascript:void(0)" onclick="window.open('http://www.baidu.com', 'newwindow', 'height=200, width=400, top='+Math.round((window.screen.height-200)/2)+',left='+Math.round((window.screen.width-400)/2)+',toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')">同意交换</a>
      

  4.   

    <A href="#" onclick="window.open('/inc/***.html,'','width=628,height=485,top='+(screen.height-485)/2+',left='+(screen.width-628)/2+',toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no');void(0);">打开基本居中的窗口</a>
      

  5.   

    我的意思是说FF中www.baidu.com怎能在当前窗口中弹出,而不是打开新标签页?