var width = 800; var height = 330; var left = parseInt((screen.availWidth/2) - (width/2)); var top = parseInt((screen.availHeight/2) - (height/2)); function MM_openBrWindow(theURL,winName) { var windowFeatures = "width=" + width + ",height=" + height + ",status=no,resizable=yes ,left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top; window.open(theURL,winName,windowFeatures); }
你可以调整top与left的值来控制窗口位置
position: absolute;
top:200;
left:400;
根据你的需求调整top和left的数值就可以,这个我用过的
var width = 800;
var height = 330;
var left = parseInt((screen.availWidth/2) - (width/2));
var top = parseInt((screen.availHeight/2) - (height/2));
function MM_openBrWindow(theURL,winName) {
var windowFeatures = "width=" + width + ",height=" + height + ",status=no,resizable=yes ,left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top;
window.open(theURL,winName,windowFeatures);
}