js弹出窗口居中显示

//弹出窗口的宽度
var iWidth;
//弹出窗口的高度
var iHeight;
var y = (window.screen.availHeight-30-iHeight)/2;    //获得窗口的垂直位置;
var x = (window.screen.availWidth-10-iWidth)/2;      //获得窗口的水平位置;
window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+y+',left='+x+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');}
 
原文地址:https://www.cnblogs.com/jianxie/p/2578075.html