Web Source2014. 10. 6. 14:35

네이버에서는 검색이 어려운 블로그입니다. 구글검색을 이용해 주세요.



팝업창 윈도우 중앙에 열기

듀얼모니터까지 지원한다.



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');


Posted by 영육치료