方法一:
<script>
function opW(){
var ye=window.open('','yexj00','width=400,height=200');
ye.moveTo((screen.availWidth-400)/2,(screen.availHeight-200)/2);
}
</script>
<input type=button value=打开居中的新窗口 hideFocus=true
function opW(){
var ye=window.open('','yexj00','width=400,height=200');
ye.moveTo((screen.availWidth-400)/2,(screen.availHeight-200)/2);
}
</script>
<input type=button value=打开居中的新窗口 hideFocus=true
有移动延迟
方法二:
ShowDialog(url)
{
var iWidth=300; //窗口宽度
var iHeight=200;//窗口高度
var iTop=(screen.height-iHeight)/2;
var iLeft=(screen.width-iWidth)/2;
open(url,"Detail","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no,Width="+iWidth+" ,Height="+iHeight+",top="+iTop+",left="+iLeft);
}
{
var iWidth=300; //窗口宽度
var iHeight=200;//窗口高度
var iTop=(screen.height-iHeight)/2;
var iLeft=(screen.width-iWidth)/2;
open(url,"Detail","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no,Width="+iWidth+" ,Height="+iHeight+",top="+iTop+",left="+iLeft);
}
这个比较好
本文转自terryli51CTO博客,原文链接:http://blog.51cto.com/terryli/519580 ,如需转载请自行联系原作者