// 方法1 function openWindowNotBlank(_url, name, _w, _h) { _w = _w ? _w : screen.width; _h = _h ? _h : screen.height; var newwin = window.open(_url, name, "width="+ _w+ "px,height="+ _h+ "px, status=no, help=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes"); return newwin; } // 测试 // 方法二 function openStaticWindow(_url, target, _w, _h) { _w = _w ? _w : screen.width; _h = _h ? _h : screen.height; var newwin = null; if (typeof (staticWindow) === 'undefined' || staticWindow.closed) { newwin = window.open(_url, target,"width="+ _w + ",height="+ _h + ","+ "left="+ (screen.width - _w)/ 2 + ",top="+ (screen.height - _h)/ 2+ "," + "status=no,help=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no"); newwin.location.href = _url; staticWindow = newwin; staticWindow.focus(); } else { staticWindow.name = target; staticWindow.location = _url; staticWindow.resizeTo(_w, _h); staticWindow.focus(); } }
// 测试
第二种方式可指定某个窗口打开新窗口