/*
* 팝업 자동 리사이징
* - 윈도 환경에 따라 사이즈가 다를 수 있습니다.
* - 팝업페이지의 스크립트 최하단에서 실행하십시오.
*
* (ex.) window.onload = function(){popupAutoResize();}
*/
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+ "===" +maxThisX );
//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);
}
'Web Programing! > Script' 카테고리의 다른 글
[SCRIPT] eval() - 변수를 함수에 대입해서 변수명으로 쓰기 (0) | 2011.09.13 |
---|---|
[SCRIPT] scriptX 웹 화면 프린트하기 (0) | 2011.09.13 |
[CSS] 가로세로 스크롤바 없애기 (0) | 2011.09.13 |
[SCRIPT] 이미지 리사이징 (0) | 2011.09.13 |
[SCRIPT] input box에 숫자만 입력받기(ie/ff 사용가능) (0) | 2011.09.10 |
[SCRIPT] setTimeout() 와 setInterval() (0) | 2011.08.30 |
[SCRIPT] 현재 날짜 구하기 (년-월-일/시-분-초) (0) | 2011.07.17 |