js(window.open)浏览器弹框居中显示

    <span style="background-color: rgb(204, 204, 204);"><html>   
    <meta name="name" content="content" charset="utf-8">  
    <head>   
    <script LANGUAGE="javascript">   
          
      
    function openwin(){  
        var openUrl = "http://www.baidu.com";//弹出窗口的url  
        var iWidth=400; //弹出窗口的宽度;  
        var iHeight=100; //弹出窗口的高度;  
        var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;  
        var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;  
        window.open(openUrl,"","height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft);   
    }  
    </script>   
    </head>   
    <body >   
    <a href="javaxript:" onclick="openwin()">点击</a>  
    </body>   
    </html></span>  

 

 

window.open('OperationDetail.aspx?id=' + id, "", "height=" + 400 + ", width=" + 600 + ", top=" + (window.screen.availHeight - 30 - 400) / 2 + ", left=" + (window.screen.availWidth - 10 - 600) / 2);

 

posted @ 2017-11-02 17:21  哪啊哪啊神去村  阅读(1104)  评论(0编辑  收藏  举报