window.open

原创 韩秀利 随笔 javascript 93阅读 30 天前 举报

var openWindow = function(url, options) {
var str = "";
if (options) {
options.height = options.height || 420;
options.width = options.width || 550;
options.left = options.left || ((screen.width - options.width) / 2); //默认为居中
options.top = options.top || ((screen.height - options.height) / 2); //默认为居中

for (var i in options) {
str += ',' + i + '=' + options[i];
}
str = str.substr(1);
};
window.open(url, 'connectwindow'+ (+new Date), str);//参数1为url,参数2为了能可以重复弹出
str = null;
};

评论 ( 0 )
最新评论
暂无评论

赶紧努力消灭 0 回复