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);
相關文章
相關標籤/搜索