웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
자바스크립트로 윈도우 흉내내기 (?)
2003.11.03 15:16
대략 5시간동안 안 돌아가는 머리 강제로 태엽 감으면서 만든 소스입니다-_-;;;
중간에 소스 하나는 모를 곳에서 가져왔는데 어떤 분의 것인지 모르겠네요-_-;;;
그리 쓰일 곳은 없을 겁니다;;;
하지만 사용하실 분은 사용해주세요;ㅁ;/
예제 : http://zective.com/WinJS.html
----------------------------------------------------------------------------------------------------
<html>
<title>Windows In JavaScript (Test Ver.)</title>
<head>
<style>
div {position:absolute; font-size:8px; font-family:Tahoma; z-index:2; text-align:center;}
button {font-size:14px; font-family:Tahoma; background:gray; border:0 solid #333333; color:white; font-weight:normal; width:22;}
</style>
<script>
// Windows In JavaScript (Test Ver.)
// This source is created by Zective (http://zective.com)
// Div 태그와 Table 태그 그리고 JavaScript 를 이용하여 윈도우 구조 비슷하게 나타내기 위한 스크립트
D_curX = D_curY = 0;
D_now = null;
D_prev = null;
D_1stmv = 1;
lrs = null;
dtm = null;
stm = null;
document.onmouseup = FinishDrag;
function FinishDrag() {
if(document.onmousemove == OnDragMove) {
if(D_now.style.pixelLeft < 0) D_now.style.pixelLeft = 1;
if(D_now.style.pixelTop < 0) D_now.style.pixelTop = 1;
/*
l = document.body.clientWidth - D_now.style.pixelWidth;
l = document.body.clientHeight-D_now.style.pixelHeight;
*/
}
if(document.onmousemove == OnResizeMove) lrs.Finish();
document.onmousemove = null;
D_now = null;
}
function BeginDragging(lyr) {
D_now = lyr;
D_1stmv = 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 resize1(_child, _ream, _tream, _wmax, _hmax) {
var tream, wlream, hlream, wmax, hmax;
tream = _ream + 1;
wlream = _ream + 1;
hlream = _ream - 4;
wmax = _wmax - wlream;
hmax = _hmax - hlream;
cele = eval("document.all."+_child+".style");
cele1 = parseInt(cele.width);
cele2 = parseInt(cele.height);
hidele = eval("document.all."+_child+"c.style");
hidele.display = 'block';
if(cele1 < _wmax) {
cele.width = cele1 + _ream;
play1 = setInterval("resize1('"+_child+"',"+_ream+","+_tream+","+_wmax+","+_hmax+")" , 0);
} else if(cele2 < _hmax) {
cele.height = cele2 + _ream;
play1 = setInterval("resize1('"+_child+"',"+_ream+","+_tream+","+_wmax+","+_hmax+")" , 0);
} else if(cele1 >= wmax && cele2 >= hmax) {
clearInterval();
} else {
cele.width = cele1;
cele.height = cele2;
clearInterval(play1);
}
}
function resize2(_child, _ream, _tream, _wmin, _hmin) {
var tream;
tream = _ream + 1;
cele = eval("document.all."+_child+".style");
cele1 = parseInt(cele.width);
cele2 = parseInt(cele.height);
hidele = eval("document.all."+_child+"c.style");
if(cele2 > _hmin) {
cele.height = cele2 - _ream;
play2 = setInterval("resize2('"+_child+"',"+_ream+","+_tream+","+_wmin+","+_hmin+")" , 0);
} else if(cele1 > _wmin) {
cele.width = cele1 - _ream;
play2 = setInterval("resize2('"+_child+"',"+_ream+","+_tream+","+_wmin+","+_hmin+")" , 0);
} else if(cele1 <= _wmin && cele2 <= _hmin) {
clearInterval();
hidele.display = 'none';
} else {
cele.width = cele1;
cele.height = cele2;
clearInterval(play2);
}
}
function DoExit(_obj, _order) {
dele = eval("document.all."+_obj+".style");
if(_order == 0) {
dele.display = 'block';
} else {
dele.display = 'none';
}
}
</script>
</head>
<body bgcolor="white">
<div id="parent1" style="left:230; top:150; text-align:right; display:none; z-index:99;" oncontextmenu="return false;">
<table id="child1" onmousedown="diOnMouseDown(parent1)" cellspacing="0" cellpadding="0" border="0" style="border:1 solid black; width:250px; height:19px; left:0; top:0; background:#999999; cursor:move;">
<tr height="21">
<td style="font size:11px Tahamo;" valign="middle">
<b>Title</b>
</td>
<td align="right" valign="top">
<button onclick="resize2('child1', 4, 2, 250, 22);" style="height:21; vertical-align:top;">_</button>
<button onclick="resize1('child1', 4, 2, 500, 200);" style="height:21; vertical-align:top;">▣</button>
<button onclick="DoExit('parent1', 1);" style="height:21; vertical-align:top;">X</button>
</td>
</tr>
<tr height="1" bgcolor="black">
<td colspan="2">
</td>
</tr>
<tr id="child1c" style="display:none; background:white;" valign="top">
<td colspan="2" style="font size:11px Tahamo;">
<table cellspacing="1" cellpadding="1" border="0" align="left">
<tr>
<td style="font size:12px 굴림; color:black;">
후훗...-_-;;;;
<br>
테스트입니다-_-;
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="link1" style="left:500; top:230;" onmousedown="diOnMouseDown(link1)" oncontextmenu="return false;">
<a title="ZecWindows Open (Double Click!)" href="javascript:;" ondblclick="DoExit('parent1', 0);" onfocus="this.blur();" style="text-align:center; width:52; font size:11px Tahoma; border:1 solid black; text-decoration:none;"><font style="font size:30px;"><b>W</b></font><br><b>ZecWin</b></a>
</div>
</body>
</html>
중간에 소스 하나는 모를 곳에서 가져왔는데 어떤 분의 것인지 모르겠네요-_-;;;
그리 쓰일 곳은 없을 겁니다;;;
하지만 사용하실 분은 사용해주세요;ㅁ;/
예제 : http://zective.com/WinJS.html
----------------------------------------------------------------------------------------------------
<html>
<title>Windows In JavaScript (Test Ver.)</title>
<head>
<style>
div {position:absolute; font-size:8px; font-family:Tahoma; z-index:2; text-align:center;}
button {font-size:14px; font-family:Tahoma; background:gray; border:0 solid #333333; color:white; font-weight:normal; width:22;}
</style>
<script>
// Windows In JavaScript (Test Ver.)
// This source is created by Zective (http://zective.com)
// Div 태그와 Table 태그 그리고 JavaScript 를 이용하여 윈도우 구조 비슷하게 나타내기 위한 스크립트
D_curX = D_curY = 0;
D_now = null;
D_prev = null;
D_1stmv = 1;
lrs = null;
dtm = null;
stm = null;
document.onmouseup = FinishDrag;
function FinishDrag() {
if(document.onmousemove == OnDragMove) {
if(D_now.style.pixelLeft < 0) D_now.style.pixelLeft = 1;
if(D_now.style.pixelTop < 0) D_now.style.pixelTop = 1;
/*
l = document.body.clientWidth - D_now.style.pixelWidth;
l = document.body.clientHeight-D_now.style.pixelHeight;
*/
}
if(document.onmousemove == OnResizeMove) lrs.Finish();
document.onmousemove = null;
D_now = null;
}
function BeginDragging(lyr) {
D_now = lyr;
D_1stmv = 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 resize1(_child, _ream, _tream, _wmax, _hmax) {
var tream, wlream, hlream, wmax, hmax;
tream = _ream + 1;
wlream = _ream + 1;
hlream = _ream - 4;
wmax = _wmax - wlream;
hmax = _hmax - hlream;
cele = eval("document.all."+_child+".style");
cele1 = parseInt(cele.width);
cele2 = parseInt(cele.height);
hidele = eval("document.all."+_child+"c.style");
hidele.display = 'block';
if(cele1 < _wmax) {
cele.width = cele1 + _ream;
play1 = setInterval("resize1('"+_child+"',"+_ream+","+_tream+","+_wmax+","+_hmax+")" , 0);
} else if(cele2 < _hmax) {
cele.height = cele2 + _ream;
play1 = setInterval("resize1('"+_child+"',"+_ream+","+_tream+","+_wmax+","+_hmax+")" , 0);
} else if(cele1 >= wmax && cele2 >= hmax) {
clearInterval();
} else {
cele.width = cele1;
cele.height = cele2;
clearInterval(play1);
}
}
function resize2(_child, _ream, _tream, _wmin, _hmin) {
var tream;
tream = _ream + 1;
cele = eval("document.all."+_child+".style");
cele1 = parseInt(cele.width);
cele2 = parseInt(cele.height);
hidele = eval("document.all."+_child+"c.style");
if(cele2 > _hmin) {
cele.height = cele2 - _ream;
play2 = setInterval("resize2('"+_child+"',"+_ream+","+_tream+","+_wmin+","+_hmin+")" , 0);
} else if(cele1 > _wmin) {
cele.width = cele1 - _ream;
play2 = setInterval("resize2('"+_child+"',"+_ream+","+_tream+","+_wmin+","+_hmin+")" , 0);
} else if(cele1 <= _wmin && cele2 <= _hmin) {
clearInterval();
hidele.display = 'none';
} else {
cele.width = cele1;
cele.height = cele2;
clearInterval(play2);
}
}
function DoExit(_obj, _order) {
dele = eval("document.all."+_obj+".style");
if(_order == 0) {
dele.display = 'block';
} else {
dele.display = 'none';
}
}
</script>
</head>
<body bgcolor="white">
<div id="parent1" style="left:230; top:150; text-align:right; display:none; z-index:99;" oncontextmenu="return false;">
<table id="child1" onmousedown="diOnMouseDown(parent1)" cellspacing="0" cellpadding="0" border="0" style="border:1 solid black; width:250px; height:19px; left:0; top:0; background:#999999; cursor:move;">
<tr height="21">
<td style="font size:11px Tahamo;" valign="middle">
<b>Title</b>
</td>
<td align="right" valign="top">
<button onclick="resize2('child1', 4, 2, 250, 22);" style="height:21; vertical-align:top;">_</button>
<button onclick="resize1('child1', 4, 2, 500, 200);" style="height:21; vertical-align:top;">▣</button>
<button onclick="DoExit('parent1', 1);" style="height:21; vertical-align:top;">X</button>
</td>
</tr>
<tr height="1" bgcolor="black">
<td colspan="2">
</td>
</tr>
<tr id="child1c" style="display:none; background:white;" valign="top">
<td colspan="2" style="font size:11px Tahamo;">
<table cellspacing="1" cellpadding="1" border="0" align="left">
<tr>
<td style="font size:12px 굴림; color:black;">
후훗...-_-;;;;
<br>
테스트입니다-_-;
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="link1" style="left:500; top:230;" onmousedown="diOnMouseDown(link1)" oncontextmenu="return false;">
<a title="ZecWindows Open (Double Click!)" href="javascript:;" ondblclick="DoExit('parent1', 0);" onfocus="this.blur();" style="text-align:center; width:52; font size:11px Tahoma; border:1 solid black; text-decoration:none;"><font style="font size:30px;"><b>W</b></font><br><b>ZecWin</b></a>
</div>
</body>
</html>
댓글 15
제목 | 글쓴이 | 날짜 |
---|---|---|
[초간단 자바스크립트(강의)!] 입력박스에 입력한 주소로 이동하기... | ∑Ztxy | 2003.09.27 |
[초간단 자바스크립트!] 홈페이지에 FTP 폼 넣기?! [10] | ∑Ztxy | 2003.09.29 |
게시판 스킨에 프린트 버튼 추가하기 [3] | PHASE | 2003.09.30 |
개판 오분전 만년달력......ㅡ,.ㅡ [4] | 미친개 | 2003.10.08 |
[초간단 자바스크립트!] 날짜 카운터! 커플홈에 강추!! [15] | ∑Ztxy | 2003.10.08 |
개판 오분전 - 이미지 뷰에 관한 한가지 힌트 [5] | 미친개 | 2003.10.11 |
새창 띄운후 부모창 확인없이 닫기... [4] | PHASE | 2003.10.12 |
플래시 크기 바꾸기 [IE/NS 겸용] [4] | teslaMINT | 2003.10.13 |
[초간단 자바스크립트!] 트랜지션 공지사항!! | ∑Ztxy | 2003.10.13 |
스물을 세면 죽음이야~~~ [20] | 미친개 | 2003.10.14 |
[초간단 자바스크립트!] 자바로 플래시 따라하기! [3] | ∑Ztxy | 2003.10.15 |
더 이상의 필터링은 없다!!! [10] | 미친개 | 2003.10.26 |
식대 계산기... ^^ [3] | 김주형 | 2003.10.27 |
클릭하면 홈페이지를 시작페이지로 하는 소스... [7] | 젤군 | 2003.10.28 |
마우스 이벤트 발생시 문서 상,하단으로 이동 [3] | RedEye(kaist) | 2003.10.30 |
[초간단 자바스크립트!] 이미지 드래그하기..~~ [8] | ∑Ztxy | 2003.11.02 |
자바스크립트로 윈도우 흉내내기 (?) [15] | 뒹굴리스트 | 2003.11.03 |
자바스크립트로 작성한 그림맞추기 퍼즐게임 [2] | 김별 | 2003.11.05 |
정말 멋있는 글자 변환 스크립트 [12] | sythesis | 2003.11.07 |
날짜카운터 숫자로만 입력하자. [3] | TechnoKevin™ | 2003.11.08 |