<script language="javascript" type="text/javascript">
<!--
// 팝업 창 크기 조절
function setPopResize(intWidth, intHeight)
{
var objBody = window.document.body;
var objDocument = window.document.documentElement;
var intResizeWidth;
var intResizeHeight;
// 너비 입력이 없을 경우 설정
if (isBlank(intWidth) || (intWidth == 0)){
intWidth = objBody.scrollWidth;
}
// 높이 입력이 없을 경우 설정
if (isBlank(intHeight) || (intHeight == 0)){
intHeight = objBody.scrollHeight;
}
if (window.innerWidth){
intResizeWidth = intWidth - window.innerWidth;
} else if (objDocument && objDocument.clientWidth){
intResizeWidth = intWidth - objDocument.clientWidth;
} else if (objBody && objBody.clientWidth){
intResizeWidth = intWidth - objBody.clientWidth;
}
if (window.innerHeight){
intResizeHeight = intHeight - window.innerHeight;
} else if (objDocument && objDocument.clientHeight){
intResizeHeight = intHeight - objDocument.clientHeight;
} else if (objBody && objBody.clientHeight){
intResizeHeight = intHeight - objBody.clientHeight;
}
window.resizeBy(intResizeWidth, intResizeHeight);
}
// 팝업 가운데 정렬
function setPopCenter()
{
var intLeft;
var intTop;
if (document.layers){
var intLeft = (screen.width / 2) - (outerWidth / 2);
var intTop = (screen.height / 2) - (outerHeight / 2);
} else{
var intLeft = (screen.width / 2) - (document.body.offsetWidth / 2);
var intTop = (screen.height / 2) - (document.body.offsetHeight / 2) - 75;
}
window.moveTo(intLeft, intTop);
}
// 팝업 오용 금지
function checkFuncKey()
{
var winEvent;
winEvent = window.event;
if ((winEvent.ctrlLeft || winEvent.ctrlKey) &&
((winEvent.keyCode == 67) || (winEvent.keyCode == 86) || (winEvent.keyCode == 87) || (winEvent.keyCode == 88))){
return;
}
if (winEvent.ctrlLeft || winEvent.ctrlKey){
winEvent.returnValue = false;
winEvent.cancelBubble = true;
return;
}
switch(winEvent.keyCode)
{
case 93: // 기능키
case 116: // F5
case 117: // F6
case 122: // F11
winEvent.keyCode = 0;
winEvent.cancelBubble = true;
winEvent.returnValue = false;
}
}
function N_addEvent(obj, act, fnc)
{
if (obj.addEventListener) {
obj.addEventListener(act, fnc, false);
} else if (obj.attachEvent) {
obj.attachEvent("on" + act, fnc);
}
}
// 팝업 초기화 설정
function initPop(intWidth, intHeight, blnCenter, blnStopAbusing)
{
setPopResize(intWidth, intHeight);
if (blnCenter == 1){
setPopCenter();
}
if (blnStopAbusing == 1){
document.oncontextmenu = function(){return false;};
document.onselectstart = function(){return false;};
document.ondragstart = function(){return false;};
document.onkeydown = function(){checkFuncKey();};
}
window.focus();
}
// 가로크기, 세로크기(0으로설정시 자동계산), 가운데정렬여부, 어뷰징금지여부)
N_addEvent(window, "load", function(){initPop(510, 0, 0, 0);});
//-->
</script>
출처 : 우리회사 이수석님
'JAVA' 카테고리의 다른 글
asx 태그를 jsp로 저장해서 사용하는 방법 (0) | 2013.01.22 |
---|---|
cookie (0) | 2013.01.22 |
형변환 (0) | 2013.01.22 |