您的位置:首页 > 职场人生

怎样让弹出对话框居中显示

2007-06-26 02:08 253 查看
方法一:
<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
有移动延迟
方法二:
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);
}
这个比较好
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息