济南网页设计|自助建站济南网站建设|聊城网站建设济南网站制作|济南网站优化 http://www.mzwkj.com www.tuanqv.com

如何把弹出窗口定位在屏幕的中央?

 //居中弹出窗体
function getwindow(URL,width,height)
{
//根据屏幕居中
window.open(URL,'','width='+width+',height='+height+',top='+(screen.height-height)/2+',left='+(screen.width-width)/2);
//下面是根据页面居中
//window.open(URL,'','width='+width+',height='+height+',top='+(document.body.offsetHeight-height)/2+',left='+(document.body.offsetWidth-width)/2);
//window.open(URL,'','width='+width+',height='+height+',top=250,left='+document.body.offsetWidth/3);
}
---------------------------------------------------------------

弹出窗口中加上:
<body>
....
</body>
<script>
top.moveTo(screen.width/2-document.body.clientWidth/2,screen.height/2-document.body.clientHeight/2)
</script>

posted on 2009-03-10 18:00  路大侠  阅读(480)  评论(0)    收藏  举报

导航

济南户外拓展|企业户外拓展 http://www.tuanqv.com