팝업창 resize
일/javascript 2010. 2. 16. 17:09출처:어디서 베겨온것은 확실한데.. 기억이 나질않는다;;이름 모를 고마운분께 감사를...
function popupAutoResize() {
var thisX = parseInt(document.body.scrollWidth);
var thisY = parseInt(document.body.scrollHeight);
var maxThisX = screen.width - 50;
var maxThisY = screen.height - 50;
var marginY = 0;
// alert(thisX + "===" + thisY);
//alert("임시 브라우저 확인 : " + navigator.userAgent);
// 브라우저별 높이 조절. (표준 창 하에서 조절해 주십시오.)
if (navigator.userAgent.indexOf("MSIE 6") > 0) marginY = 45; // IE 6.x
else if(navigator.userAgent.indexOf("MSIE 7") > 0) marginY = 75; // IE 7.x
else if(navigator.userAgent.indexOf("Firefox") > 0) marginY = 50; // FF
else if(navigator.userAgent.indexOf("Opera") > 0) marginY = 30; // Opera
else if(navigator.userAgent.indexOf("Netscape") > 0) marginY = -2; // Netscape
if (thisX > maxThisX) {
window.document.body.scroll = "yes";
thisX = maxThisX;
}
if (thisY > maxThisY - marginY) {
window.document.body.scroll = "yes";
thisX += 19;
thisY = maxThisY - marginY;
}
window.resizeTo(thisX+10, thisY+marginY);
// 센터 정렬
// var windowX = (screen.width - (thisX+10))/2;
// var windowY = (screen.height - (thisY+marginY))/2 - 20;
// window.moveTo(windowX,windowY);
}