您的位置:首页 > Web前端 > JavaScript

JS只弹出一个居中弹出窗口

2014-05-21 23:29 316 查看
var newWindow;//定义一个窗口,有利于窗口间的通讯

function makeNewWindow(url) {

if (!newWindow || newWindow.closed) {

var width = 400;

var height = 300;

var left = parseInt((screen.availWidth/2) - (width/2));//屏幕居中

var top = parseInt((screen.availHeight/2) - (height/2));

var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;

newWindow = window.open(url, "subWind", windowFeatures);

} else {

// window is already open, so bring it to the front

newWindow.focus();

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: