<!--클래스-->
<script>
Layer = function() {
this.Elem = document.createElement('div');
this.Elem.id = 'Layer' + Layer.Count++;
this.Elem.appendChild(document.createElement('div'));
this.Elem.appendChild(document.createElement('div'));
// Properties
this.Id = this.Elem.id;
this.Drag = true;
this.Subject = 'Layer';
this.Content = 'Content';
this.Style = this.Elem.style;
this.SubjectStyle = this.Elem.children[0].style;
this.ContentStyle = this.Elem.children[1].style;
//
// Init
with(this.Style) {
position = 'absolute';
border = '1px solid slategray';
zIndex = Layer.ZIndex++;
}
with(this.SubjectStyle) {
font = 'bold 9pt tahoma';
backgroundColor = 'slategray';
color = 'lightgrey';
padding = '3px';
cursor = 'default';
}
with(this.ContentStyle) {
font = 'normal 9pt tahoma';
backgroundColor = 'whitesmoke';
color = 'slategray';
padding = '3px';
}
//
// Show Method
this.Show = function() {
document.body.appendChild(this.Elem);
this.Refresh();
}//
// Refresh Method
this.Refresh = function() {
this.Elem.children[1].innerHTML = this.Content;
with(this.Elem.children[0]) {
innerHTML = this.Subject;
onselectstart = function() { return false; }
style.width = Math.max(this.Elem.children[1].offsetWidth, offsetWidth);
ondblclick = function() {
with(this.parentElement.children[1].style) {
display = display ? '' : 'none';
}
}
// Drag Event
if(this.Drag) {
IsDrag = false;
var PadLeft = parseInt(style.paddingLeft);
var PadTop = parseInt(style.paddingTop);
onmousedown = function() {
IsDrag = true;
DragX = event.offsetX + PadLeft;
DragY = event.offsetY + PadTop;
}
onmouseup = function() { IsDrag = false; }
onmouseout = function() { IsDrag = false; }
onmousemove = function() {
if(IsDrag) {
with(this.parentElement.style) {
left = event.clientX - DragX;
top = event.clientY - DragY;
}
}
}
}
else {
IsDrag = DragX = DragY = null;
onmousedown = onmouseup = onmouseout = onmousemove = null;
}// End Drag Event
}
}// End Refresh()
// Event z-index
this.Elem.children[0].onclick = function() { this.parentElement.style.zIndex = Layer.ZIndex++; }
this.Elem.children[1].onclick = function() { this.parentElement.style.zIndex = Layer.ZIndex++; }
}
Layer.Count = 0;
Layer.ZIndex = 100;
</script>
<!---->
<!--사용-->
<script>
window.onload = function() {
with(document) {
with(body) {
Layer1 = new Layer();
Layer1.Subject = '드래그 ON 레이어';
Layer1.Content = '나 보기가 역겨워 가실때에는<br>' +
'말 없이 고이 보내 드리오리다.<br>' +
'<img src=http://mypds.mireene.com/g4/_v1/img/mybanner05.jpg>';
Layer1.Show();
Layer2 = new Layer();
Layer2.Style.left = '200px';
Layer2.SubjectStyle.color = 'red';
Layer2.Drag = false;
Layer2.Subject = '드래그 OFF 레이어';
Layer2.Content = '드래그 되지 않는 레이어<br>타이틀을 더블클릭하면 창이 축소됩니다.';
Layer2.Show();
Layer2.ContentStyle.backgroundColor = 'ivory';
Layer2.Refresh(); // Show() 호출 후 속성이 변경되면 Refresh() 호출
};
}
}
</script>
<!----><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
<script>
Layer = function() {
this.Elem = document.createElement('div');
this.Elem.id = 'Layer' + Layer.Count++;
this.Elem.appendChild(document.createElement('div'));
this.Elem.appendChild(document.createElement('div'));
// Properties
this.Id = this.Elem.id;
this.Drag = true;
this.Subject = 'Layer';
this.Content = 'Content';
this.Style = this.Elem.style;
this.SubjectStyle = this.Elem.children[0].style;
this.ContentStyle = this.Elem.children[1].style;
//
// Init
with(this.Style) {
position = 'absolute';
border = '1px solid slategray';
zIndex = Layer.ZIndex++;
}
with(this.SubjectStyle) {
font = 'bold 9pt tahoma';
backgroundColor = 'slategray';
color = 'lightgrey';
padding = '3px';
cursor = 'default';
}
with(this.ContentStyle) {
font = 'normal 9pt tahoma';
backgroundColor = 'whitesmoke';
color = 'slategray';
padding = '3px';
}
//
// Show Method
this.Show = function() {
document.body.appendChild(this.Elem);
this.Refresh();
}//
// Refresh Method
this.Refresh = function() {
this.Elem.children[1].innerHTML = this.Content;
with(this.Elem.children[0]) {
innerHTML = this.Subject;
onselectstart = function() { return false; }
style.width = Math.max(this.Elem.children[1].offsetWidth, offsetWidth);
ondblclick = function() {
with(this.parentElement.children[1].style) {
display = display ? '' : 'none';
}
}
// Drag Event
if(this.Drag) {
IsDrag = false;
var PadLeft = parseInt(style.paddingLeft);
var PadTop = parseInt(style.paddingTop);
onmousedown = function() {
IsDrag = true;
DragX = event.offsetX + PadLeft;
DragY = event.offsetY + PadTop;
}
onmouseup = function() { IsDrag = false; }
onmouseout = function() { IsDrag = false; }
onmousemove = function() {
if(IsDrag) {
with(this.parentElement.style) {
left = event.clientX - DragX;
top = event.clientY - DragY;
}
}
}
}
else {
IsDrag = DragX = DragY = null;
onmousedown = onmouseup = onmouseout = onmousemove = null;
}// End Drag Event
}
}// End Refresh()
// Event z-index
this.Elem.children[0].onclick = function() { this.parentElement.style.zIndex = Layer.ZIndex++; }
this.Elem.children[1].onclick = function() { this.parentElement.style.zIndex = Layer.ZIndex++; }
}
Layer.Count = 0;
Layer.ZIndex = 100;
</script>
<!---->
<!--사용-->
<script>
window.onload = function() {
with(document) {
with(body) {
Layer1 = new Layer();
Layer1.Subject = '드래그 ON 레이어';
Layer1.Content = '나 보기가 역겨워 가실때에는<br>' +
'말 없이 고이 보내 드리오리다.<br>' +
'<img src=http://mypds.mireene.com/g4/_v1/img/mybanner05.jpg>';
Layer1.Show();
Layer2 = new Layer();
Layer2.Style.left = '200px';
Layer2.SubjectStyle.color = 'red';
Layer2.Drag = false;
Layer2.Subject = '드래그 OFF 레이어';
Layer2.Content = '드래그 되지 않는 레이어<br>타이틀을 더블클릭하면 창이 축소됩니다.';
Layer2.Show();
Layer2.ContentStyle.backgroundColor = 'ivory';
Layer2.Refresh(); // Show() 호출 후 속성이 변경되면 Refresh() 호출
};
}
}
</script>
<!----><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]</div>
댓글 1개
pearly
19년 전
좋은팁 감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 130 | 20년 전 | 3998 | ||
| 129 | 20년 전 | 2934 | ||
| 128 | 20년 전 | 3668 | ||
| 127 | 20년 전 | 3501 | ||
| 126 | 20년 전 | 3758 | ||
| 125 | 20년 전 | 8587 | ||
| 124 | 20년 전 | 2601 | ||
| 123 | 20년 전 | 3743 | ||
| 122 | 20년 전 | 3205 | ||
| 121 | 20년 전 | 2609 | ||
| 120 | 20년 전 | 2669 | ||
| 119 | 20년 전 | 2580 | ||
| 118 | 20년 전 | 2859 | ||
| 117 |
|
20년 전 | 3055 | |
| 116 | 20년 전 | 5307 | ||
| 115 | 20년 전 | 3919 | ||
| 114 | 20년 전 | 4967 | ||
| 113 | 20년 전 | 6209 | ||
| 112 | 20년 전 | 7322 | ||
| 111 | 20년 전 | 18430 | ||
| 110 | 20년 전 | 6872 | ||
| 109 | 20년 전 | 2877 | ||
| 108 | 20년 전 | 4137 | ||
| 107 |
prosper
|
20년 전 | 2497 | |
| 106 |
prosper
|
20년 전 | 4314 | |
| 105 |
아우겐나이스
|
20년 전 | 2912 | |
| 104 | 20년 전 | 2256 | ||
| 103 | 20년 전 | 2476 | ||
| 102 | 20년 전 | 2254 | ||
| 101 | 20년 전 | 2572 | ||
| 100 | 20년 전 | 1744 | ||
| 99 | 20년 전 | 1564 | ||
| 98 | 20년 전 | 1615 | ||
| 97 | 20년 전 | 2127 | ||
| 96 | 20년 전 | 1871 | ||
| 95 | 20년 전 | 2372 | ||
| 94 | 20년 전 | 3564 | ||
| 93 | 20년 전 | 1558 | ||
| 92 | 20년 전 | 1755 | ||
| 91 | 20년 전 | 3179 | ||
| 90 | 20년 전 | 2339 | ||
| 89 | 20년 전 | 3169 | ||
| 88 | 20년 전 | 2869 | ||
| 87 | 20년 전 | 3293 | ||
| 86 | 20년 전 | 5131 | ||
| 85 | 20년 전 | 2517 | ||
| 84 | 20년 전 | 4824 | ||
| 83 | 20년 전 | 2501 | ||
| 82 | 20년 전 | 3119 | ||
| 81 | 20년 전 | 7624 | ||
| 80 | 20년 전 | 3820 | ||
| 79 | 20년 전 | 3206 | ||
| 78 | 20년 전 | 4694 | ||
| 77 | 20년 전 | 2897 | ||
| 76 | 20년 전 | 6215 | ||
| 75 | 20년 전 | 4470 | ||
| 74 | 20년 전 | 5780 | ||
| 73 | 20년 전 | 3625 | ||
| 72 | 20년 전 | 5967 | ||
| 71 | 20년 전 | 3117 | ||
| 70 | 20년 전 | 2837 | ||
| 69 | 20년 전 | 2640 | ||
| 68 | 20년 전 | 2444 | ||
| 67 | 20년 전 | 2653 | ||
| 66 | 20년 전 | 2669 | ||
| 65 | 20년 전 | 3785 | ||
| 64 | 20년 전 | 2825 | ||
| 63 | 20년 전 | 2454 | ||
| 62 | 20년 전 | 2264 | ||
| 61 | 20년 전 | 3069 | ||
| 60 | 20년 전 | 3134 | ||
| 59 | 20년 전 | 2515 | ||
| 58 | 20년 전 | 2589 | ||
| 57 | 20년 전 | 2967 | ||
| 56 | 20년 전 | 2317 | ||
| 55 | 20년 전 | 2761 | ||
| 54 | 20년 전 | 2128 | ||
| 53 | 20년 전 | 2348 | ||
| 52 | 20년 전 | 2698 | ||
| 51 |
prosper
|
21년 전 | 2351 | |
| 50 |
prosper
|
21년 전 | 2170 | |
| 49 | 21년 전 | 2176 | ||
| 48 | 21년 전 | 2337 | ||
| 47 | 21년 전 | 1931 | ||
| 46 | 21년 전 | 1927 | ||
| 45 | 21년 전 | 2131 | ||
| 44 | 21년 전 | 2358 | ||
| 43 | 21년 전 | 4572 | ||
| 42 |
prosper
|
21년 전 | 2714 | |
| 41 |
prosper
|
21년 전 | 2113 | |
| 40 | 21년 전 | 2178 | ||
| 39 | 21년 전 | 2145 | ||
| 38 | 21년 전 | 2418 | ||
| 37 | 21년 전 | 2568 | ||
| 36 | 21년 전 | 1770 | ||
| 35 | 21년 전 | 4070 | ||
| 34 | 21년 전 | 3850 | ||
| 33 | 21년 전 | 2990 | ||
| 32 |
prosper
|
21년 전 | 2903 | |
| 31 | 21년 전 | 5276 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기