日期:2014-05-17  浏览次数:20674 次

window.open的问题
windo.open('','','')中的第三个参数可以设置新的页面的left和top 
如果我要新的页面始终显示在屏幕的中间(要相对的 可以在不同显示器中都显示在中间) 
如何设置这个left和top?

------解决方案--------------------
function sWin(url)
{
splashWin = window.open(url,'tip','fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,');
splashWin.moveTo(window.event.screenX/2,window.event.screenY/2);
splashWin.focus();
}
------解决方案--------------------
window.open("a.html",null,"top="+(document.body.clientHeight/2-200/2)+",left="+(document.body.clientWidth/2-400/2+",height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");


上面的200 和 400 是弹出窗口大小