네이버에서는 검색이 어려운 블로그입니다. 구글검색을 이용해 주세요.
팝업창 윈도우 중앙에 열기
듀얼모니터까지 지원한다.
http://www.xtf.dk/2011/08/center-new-popup-window-even-on.html
function PopupCenter(url, title, w, h) {
// Fixes dual-screen position Most browsers Firefox
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
var top = ((height / 2) - (h / 2)) + dualScreenTop;
var newWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
// Puts focus on the newWindow
if (window.focus) {
newWindow.focus();
}
}
PopupCenter('http://www.xtf.dk','xtf','900','500');
'Web Source' 카테고리의 다른 글
indexOf, indexOf not working, indexOf() Versions of IE before IE9 (0) | 2014.10.27 |
---|---|
CSS style font-weight Property (0) | 2014.10.21 |
Get Cross Domain iFrame Content (0) | 2014.09.25 |
PHP - Browser detection - IE, Firefox, Safari, Chrome (0) | 2014.09.22 |
iFrame auto resizer (0) | 2014.09.04 |