<!--클래스-->
<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년 전
좋은팁 감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 230 | 20년 전 | 2049 | ||
| 229 | 20년 전 | 3131 | ||
| 228 | 20년 전 | 3322 | ||
| 227 | 20년 전 | 2385 | ||
| 226 | 20년 전 | 5468 | ||
| 225 | 20년 전 | 2515 | ||
| 224 | 20년 전 | 2962 | ||
| 223 | 20년 전 | 4199 | ||
| 222 | 20년 전 | 2603 | ||
| 221 | 20년 전 | 2286 | ||
| 220 | 20년 전 | 3673 | ||
| 219 | 20년 전 | 2065 | ||
| 218 | 20년 전 | 3561 | ||
| 217 | 20년 전 | 2473 | ||
| 216 | 20년 전 | 2904 | ||
| 215 | 20년 전 | 2217 | ||
| 214 | 20년 전 | 3331 | ||
| 213 | 20년 전 | 2910 | ||
| 212 | 20년 전 | 3042 | ||
| 211 | 20년 전 | 2143 | ||
| 210 | 20년 전 | 1888 | ||
| 209 | 20년 전 | 2342 | ||
| 208 | 20년 전 | 1970 | ||
| 207 | 20년 전 | 1670 | ||
| 206 | 20년 전 | 1852 | ||
| 205 | 20년 전 | 3943 | ||
| 204 | 20년 전 | 1672 | ||
| 203 | 20년 전 | 2006 | ||
| 202 | 20년 전 | 2352 | ||
| 201 | 20년 전 | 1820 | ||
| 200 | 20년 전 | 2948 | ||
| 199 | 20년 전 | 2004 | ||
| 198 | 20년 전 | 2083 | ||
| 197 | 20년 전 | 3646 | ||
| 196 | 20년 전 | 2976 | ||
| 195 | 20년 전 | 2088 | ||
| 194 | 20년 전 | 10239 | ||
| 193 | 20년 전 | 2240 | ||
| 192 | 20년 전 | 1591 | ||
| 191 | 20년 전 | 2657 | ||
| 190 | 20년 전 | 2283 | ||
| 189 | 20년 전 | 1678 | ||
| 188 | 20년 전 | 1471 | ||
| 187 | 20년 전 | 1903 | ||
| 186 | 20년 전 | 1704 | ||
| 185 | 20년 전 | 1743 | ||
| 184 | 20년 전 | 2342 | ||
| 183 | 20년 전 | 1547 | ||
| 182 | 20년 전 | 1479 | ||
| 181 | 20년 전 | 1621 | ||
| 180 | 20년 전 | 2714 | ||
| 179 | 20년 전 | 1797 | ||
| 178 | 20년 전 | 1848 | ||
| 177 | 20년 전 | 1974 | ||
| 176 | 20년 전 | 1797 | ||
| 175 | 20년 전 | 1870 | ||
| 174 | 20년 전 | 1692 | ||
| 173 | 20년 전 | 2055 | ||
| 172 | 20년 전 | 1781 | ||
| 171 | 20년 전 | 2553 | ||
| 170 | 20년 전 | 2265 | ||
| 169 | 20년 전 | 2545 | ||
| 168 | 20년 전 | 1470 | ||
| 167 | 20년 전 | 1572 | ||
| 166 | 20년 전 | 2144 | ||
| 165 | 20년 전 | 1614 | ||
| 164 | 20년 전 | 3763 | ||
| 163 | 20년 전 | 2652 | ||
| 162 | 20년 전 | 2074 | ||
| 161 | 20년 전 | 2782 | ||
| 160 | 20년 전 | 1726 | ||
| 159 | 20년 전 | 1600 | ||
| 158 | 20년 전 | 2559 | ||
| 157 | 20년 전 | 1483 | ||
| 156 | 20년 전 | 1730 | ||
| 155 | 20년 전 | 3226 | ||
| 154 | 20년 전 | 1884 | ||
| 153 | 20년 전 | 1617 | ||
| 152 | 20년 전 | 4945 | ||
| 151 | 20년 전 | 4567 | ||
| 150 | 20년 전 | 3509 | ||
| 149 | 20년 전 | 3775 | ||
| 148 | 20년 전 | 7064 | ||
| 147 | 20년 전 | 3547 | ||
| 146 | 20년 전 | 2615 | ||
| 145 | 20년 전 | 2609 | ||
| 144 | 20년 전 | 7164 | ||
| 143 | 20년 전 | 4594 | ||
| 142 | 20년 전 | 1897 | ||
| 141 | 20년 전 | 3249 | ||
| 140 | 20년 전 | 1955 | ||
| 139 | 20년 전 | 1564 | ||
| 138 | 20년 전 | 2296 | ||
| 137 | 20년 전 | 1774 | ||
| 136 | 20년 전 | 1450 | ||
| 135 | 20년 전 | 1782 | ||
| 134 | 20년 전 | 2963 | ||
| 133 | 20년 전 | 2439 | ||
| 132 | 20년 전 | 1704 | ||
| 131 | 20년 전 | 1633 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기