<!--클래스-->
<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년 전
좋은팁 감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 439 | ||
| 7929 | 9년 전 | 373 | ||
| 7928 | 9년 전 | 457 | ||
| 7927 | 9년 전 | 370 | ||
| 7926 | 9년 전 | 680 | ||
| 7925 | 9년 전 | 393 | ||
| 7924 | 9년 전 | 377 | ||
| 7923 | 9년 전 | 371 | ||
| 7922 | 9년 전 | 405 | ||
| 7921 | 9년 전 | 421 | ||
| 7920 | 9년 전 | 337 | ||
| 7919 | 9년 전 | 347 | ||
| 7918 | 9년 전 | 502 | ||
| 7917 | 9년 전 | 353 | ||
| 7916 | 9년 전 | 438 | ||
| 7915 | 9년 전 | 440 | ||
| 7914 | 9년 전 | 450 | ||
| 7913 | 9년 전 | 624 | ||
| 7912 | 9년 전 | 455 | ||
| 7911 | 9년 전 | 390 | ||
| 7910 | 9년 전 | 436 | ||
| 7909 | 9년 전 | 540 | ||
| 7908 | 9년 전 | 478 | ||
| 7907 | 9년 전 | 415 | ||
| 7906 | 9년 전 | 434 | ||
| 7905 | 9년 전 | 404 | ||
| 7904 | 9년 전 | 388 | ||
| 7903 | 9년 전 | 386 | ||
| 7902 | 9년 전 | 584 | ||
| 7901 |
|
9년 전 | 762 | |
| 7900 | 9년 전 | 633 | ||
| 7899 | 9년 전 | 418 | ||
| 7898 | 9년 전 | 423 | ||
| 7897 | 9년 전 | 377 | ||
| 7896 | 9년 전 | 392 | ||
| 7895 | 9년 전 | 506 | ||
| 7894 | 9년 전 | 423 | ||
| 7893 | 9년 전 | 393 | ||
| 7892 | 9년 전 | 429 | ||
| 7891 | 9년 전 | 792 | ||
| 7890 | 9년 전 | 1224 | ||
| 7889 | 9년 전 | 761 | ||
| 7888 |
limsy1987
|
9년 전 | 571 | |
| 7887 | 9년 전 | 597 | ||
| 7886 | 9년 전 | 491 | ||
| 7885 | 9년 전 | 446 | ||
| 7884 | 9년 전 | 445 | ||
| 7883 | 9년 전 | 450 | ||
| 7882 | 9년 전 | 508 | ||
| 7881 | 9년 전 | 475 | ||
| 7880 | 9년 전 | 605 | ||
| 7879 | 9년 전 | 496 | ||
| 7878 | 9년 전 | 1263 | ||
| 7877 | 9년 전 | 790 | ||
| 7876 | 9년 전 | 530 | ||
| 7875 | 9년 전 | 603 | ||
| 7874 |
|
9년 전 | 825 | |
| 7873 | 9년 전 | 540 | ||
| 7872 | 9년 전 | 705 | ||
| 7871 | 9년 전 | 522 | ||
| 7870 | 9년 전 | 642 | ||
| 7869 | 9년 전 | 456 | ||
| 7868 | 9년 전 | 487 | ||
| 7867 | 9년 전 | 484 | ||
| 7866 | 9년 전 | 539 | ||
| 7865 | 9년 전 | 483 | ||
| 7864 | 9년 전 | 548 | ||
| 7863 | 9년 전 | 546 | ||
| 7862 | 9년 전 | 499 | ||
| 7861 | 9년 전 | 678 | ||
| 7860 | 9년 전 | 655 | ||
| 7859 | 9년 전 | 436 | ||
| 7858 | 9년 전 | 738 | ||
| 7857 | 9년 전 | 1124 | ||
| 7856 | 9년 전 | 556 | ||
| 7855 | 9년 전 | 783 | ||
| 7854 | 9년 전 | 742 | ||
| 7853 | 9년 전 | 627 | ||
| 7852 | 9년 전 | 553 | ||
| 7851 | 9년 전 | 541 | ||
| 7850 | 9년 전 | 621 | ||
| 7849 | 9년 전 | 388 | ||
| 7848 | 9년 전 | 458 | ||
| 7847 | 9년 전 | 697 | ||
| 7846 | 9년 전 | 488 | ||
| 7845 | 9년 전 | 457 | ||
| 7844 | 9년 전 | 428 | ||
| 7843 | 9년 전 | 467 | ||
| 7842 | 9년 전 | 441 | ||
| 7841 | 9년 전 | 417 | ||
| 7840 | 9년 전 | 430 | ||
| 7839 | 9년 전 | 472 | ||
| 7838 | 9년 전 | 536 | ||
| 7837 | 9년 전 | 380 | ||
| 7836 | 9년 전 | 433 | ||
| 7835 | 9년 전 | 507 | ||
| 7834 |
|
9년 전 | 1219 | |
| 7833 | 10년 전 | 472 | ||
| 7832 | 10년 전 | 454 | ||
| 7831 | 10년 전 | 608 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기