인터넷정보

크롬리스 비슷한 윈도창 띄우기

알 수 없는 사용자 2007. 10. 18. 13:48
미리보기 http://oxtag.com/html/ex/popup/win/win2.html


<script>
//Windows In JavaScript (Test Ver / Modifed)
//This source is created by Zective (http://zective.com) and modified by TheMics
//Div 태그와 Table 태그 그리고 JavaScript 를 이용하여 윈도우 구조 비슷하게 나타내기 위한 스크립트

D_curX = D_curY = 0;
D_now = null;
D_prev = null;
D_1stmv = 1;
lrs = null;
dtm = null;
stm = null;
w_size = 1;

document.onmouseup = FinishDrag;

function FinishDrag() {
        if(document.onmousemove == OnDragMove) {
                if(D_now.style.pixelLeft < 0) D_now.style.pixelLeft = 1;
                //else if(D_now.style.pixelLeft + w_width > document.body.clientWidth) D_now.style.pixelLeft = document.body.clientWidth - w_width;
                if(D_now.style.pixelTop < 0) D_now.style.pixelTop = 1;
                //else if(D_now.style.pixelTop + w_height > document.body.clientHeight) D_now.style.pixelTop = document.body.clientHeight - w_height;
        }

        if(document.onmousemove == OnResizeMove) lrs.Finish();
        if(D_now) D_now.style.filter = "";
        if(D_now && w_size == 1) ResizeForMove("2");
        document.onmousemove = null;
        D_now = null;
}

function BeginDragging(lyr) {
        D_now = lyr;
        D_1stmv = 1;
        D_now.style.filter = "alpha(opacity:60)";
        if(w_size == 1) ResizeForMove("1");
        document.onmousemove = OnDragMove;
}

function OnDragMove() {
        if(D_now == null) return true;
        if(D_1stmv) {
                D_curX = event.clientX;
                D_curY = event.clientY;
                D_1stmv = 0;
                if(D_prev != D_now) D_now.style.zIndex = D_now.style.zIndex + 1;
                D_prev = D_now;
                return false;
        }
        D_now.style.pixelLeft += (event.clientX - D_curX);
        D_now.style.pixelTop += (event.clientY - D_curY);
        D_curX = event.clientX;
        D_curY = event.clientY;
        event.returnValue = false;
}

function diOnMouseDown(i) {
        if(event.button == 1) BeginDragging(i);
        event.returnValue = false;
}

function OnResizeMove() {
        if(D_1stmv) {
                D_curX = event.clientX;
                D_curY = event.clientY;
                D_1stmv = 0;
                return false;
        }
        lrs.AddSize(event.clientX - D_curX, event.clientY - D_curY);
        D_curX = event.clientX;
        D_curY = event.clientY;
        event.returnValue = false;
}

function DoExit(_obj,_order) {
        dele = eval("document.all."+_obj+".style");
        if(_order == 0) {
                dele.display = "block";
        } else {
                dele.display = "none";
                i_frame.location.href = "about:blank";
        }
}

function ChangeFrame(name,title,width,height) {
        w_width = width;
        w_height = height;
        if(w_size == 0) Resize();
        document.all.i_window.style.width = width;
        document.all.i_window.style.height = height;
        document.all.i_frame.style.width = width - 2;
        document.all.i_frame.style.height = height - 18;
        //if(document.all.i_window.pixelLeft + width > document.body.clientWidth) document.all.i_window.pixelLeft = document.body.clientWidth - width;
        //if(document.all.i_window.pixelTop + height > document.body.clientHeight) document.all.i_window.pixelTop = document.body.clientHeight - height;
        i_title.innerHTML = title;

        if(name.substr(0,4) == "http") {
                i_frame.location.href = name;
                // reload.innerHTML = "";
        }
/*
         else {
                if(name == "search") i_frame.location.href = "http://oxtag.com/zboard/search.php";
                else if(name == "search2")i_frame.location.href = "http://oxtag.com/zboard/search.php";
                else if(name == "game")i_frame.location.href = "http://oxtag.com/html/ex/game/game.html";
                else i_frame.location.href = "http://oxtag.com/html/"+name+".html";
                reload.innerHTML = "R";
        }
*/
        DoExit("i_window",0);
}

function Resize() {
        if(w_size == 1) {
                w_size = 0;
                w_width = document.all.i_window.style.width.substr(0,3);
                w_height = document.all.i_window.style.height.substr(0,3);
                document.all.i_window.style.width = 200;
                document.all.i_window.style.height = 18;
                document.all.i_frame.style.display = "none";
        } else {
                w_size = 1;
                document.all.i_window.style.width = w_width;
                document.all.i_window.style.height = w_height;
                //if(document.all.i_window.style.pixelLeft + w_width > document.body.clientWidth) document.all.i_window.style.pixelLeft = document.body.clientWidth - w_width;
                //if(document.all.i_window.style.pixelTop + w_height > document.body.clientHeight) document.all.i_window.style.pixelTop = document.body.clientHeight - w_height;
                document.all.i_frame.style.display = "block";
        }
}

function ResizeForMove(type) {
        if(type == "1") {
                document.all.i_window.style.height = 18;
                document.all.i_frame.style.display = "none";
        } else {
                document.all.i_window.style.height = w_height;
                document.all.i_frame.style.display = "block";
        }
}
</script>

</head>
<body>

<!--윈도우 레이어-->
<div id='i_window' style='left:170;top:70;width:600;height:400;position:absolute;z-index:99'>
<table cellspacing='1' cellpadding='0' border='0' width='100%' height='100%' bgcolor='#C7B4A5'>
        <tr bgcolor='#B9A08B'>
                <td oncontextmenu='return false' onmousedown='diOnMouseDown(i_window)'>
<table cellspacing='0' cellpadding='0' border='0' width='100%' height='15'>
        <tr style='cursor:move'>
                <td class='th8'> <span id='i_title' style='font-weight:bold'></span></td>
                <td align='right' class='th8'>
<!-- <span onclick='i_frame.location.reload()' id='reload' style='cursor:hand;color:#715B52'>R</span> -->
<span onclick='Resize()' style='cursor:hand;color:#715B52'>M</span>
<span onclick='DoExit("i_window",1)' style='cursor:hand;color:#715B52'><b>X</b></span>
                </td>
        </tr>
</table>
                </td>
        </tr>
        <tr>
                <td bgcolor='white'><iframe id='i_frame' src='about:blank' frameborder='0' width='598' height='392' marginwidth='10' marginheight='10' scrolling='auto'></iframe></td>
        </tr>
</table>
</div>

** <span onclick='ChangeFrame("http://oxtag.com/zboard/search.php","title 1 - 게시판 통합검색",640,330)' style='cursor:hand'>BBS Search</span> <br>
** <span onclick='ChangeFrame("http://oxtag.com/html/ex/game/game.html","title 3 - 게임",500,330)' style='cursor:hand'>Game</span> <br>
** <span onclick='ChangeFrame("http://oxtag.com/html/ex/banner.html","title 4 - 태그피아 배너",500,330)' style='cursor:hand'>TagPia BanNer</span> <br>
** <span onclick='ChangeFrame("http://oxtag.com/html/marquee.html","title 5 - 마퀴",750,420)' style='cursor:hand'>Marquee</span> <br>
** <span ondblclick='ChangeFrame("http://oxtag.com/html/about/ctpersonal/","Administrator Page",580,420)'>admin</span><br><br>

<script>
ChangeFrame("http://oxtag.com/html/ex/game/game.html","OnLoad 시 띄우기",650,400)
</script>
반응형