码迷,mamicode.com
首页 > 其他好文 > 详细

同名窗口不能重新打开

时间:2017-10-28 12:47:01      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:focus   name   ==   scroll   变量   tool   settings   sed   href   

var globalWin;//全局变量,表示打开的那个窗口对象

 

globalsubmitForm.LaunchWindow = function (sHref, winName, width, height, top, left) {
var windowSettings = ‘status=yes,menubar=no,scrollbars=yes,toolbar=no,resizable=yes,‘;
if (width == 0 && height == 0) {
windowSettings += ‘width=‘ + (screen.width - 12);
windowSettings += ‘, height=‘ + (screen.height - 100);
windowSettings += ‘, top=0, left=0‘;
}
else {
windowSettings += ‘width=‘ + width;
windowSettings += ‘, height=‘ + height;
windowSettings += ‘, top=‘ + top;
windowSettings += ‘, left=‘ + left;
}
if (globalWin == null || globalWin.closed) {
globalWin = window.open(sHref, winName, windowSettings);
globalWin.focus();
}
else {
alert(‘同名窗口已经打开,请先关闭打开的窗口‘);
}
}

同名窗口不能重新打开

标签:focus   name   ==   scroll   变量   tool   settings   sed   href   

原文地址:http://www.cnblogs.com/LGDD/p/7746396.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!