<!--클래스-->
<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년 전
좋은팁 감사합니다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8030 | 9년 전 | 399 | ||
| 8029 | 9년 전 | 323 | ||
| 8028 | 9년 전 | 283 | ||
| 8027 | 9년 전 | 291 | ||
| 8026 | 9년 전 | 362 | ||
| 8025 | 9년 전 | 402 | ||
| 8024 | 9년 전 | 366 | ||
| 8023 | 9년 전 | 409 | ||
| 8022 | 9년 전 | 328 | ||
| 8021 | 9년 전 | 344 | ||
| 8020 | 9년 전 | 338 | ||
| 8019 | 9년 전 | 358 | ||
| 8018 | 9년 전 | 462 | ||
| 8017 | 9년 전 | 549 | ||
| 8016 | 9년 전 | 361 | ||
| 8015 | 9년 전 | 405 | ||
| 8014 | 9년 전 | 339 | ||
| 8013 | 9년 전 | 255 | ||
| 8012 | 9년 전 | 261 | ||
| 8011 | 9년 전 | 460 | ||
| 8010 | 9년 전 | 316 | ||
| 8009 | 9년 전 | 325 | ||
| 8008 | 9년 전 | 301 | ||
| 8007 | 9년 전 | 449 | ||
| 8006 | 9년 전 | 485 | ||
| 8005 |
|
9년 전 | 983 | |
| 8004 | 9년 전 | 372 | ||
| 8003 | 9년 전 | 440 | ||
| 8002 | 9년 전 | 335 | ||
| 8001 |
|
9년 전 | 681 | |
| 8000 | 9년 전 | 438 | ||
| 7999 | 9년 전 | 394 | ||
| 7998 | 9년 전 | 449 | ||
| 7997 | 9년 전 | 322 | ||
| 7996 | 9년 전 | 554 | ||
| 7995 | 9년 전 | 488 | ||
| 7994 | 9년 전 | 361 | ||
| 7993 | 9년 전 | 428 | ||
| 7992 | 9년 전 | 531 | ||
| 7991 | 9년 전 | 273 | ||
| 7990 | 9년 전 | 306 | ||
| 7989 | 9년 전 | 319 | ||
| 7988 | 9년 전 | 746 | ||
| 7987 | 9년 전 | 450 | ||
| 7986 | 9년 전 | 447 | ||
| 7985 | 9년 전 | 525 | ||
| 7984 | 9년 전 | 445 | ||
| 7983 | 9년 전 | 688 | ||
| 7982 | 9년 전 | 548 | ||
| 7981 | 9년 전 | 501 | ||
| 7980 | 9년 전 | 522 | ||
| 7979 | 9년 전 | 509 | ||
| 7978 | 9년 전 | 479 | ||
| 7977 | 9년 전 | 417 | ||
| 7976 | 9년 전 | 873 | ||
| 7975 | 9년 전 | 386 | ||
| 7974 | 9년 전 | 414 | ||
| 7973 | 9년 전 | 622 | ||
| 7972 | 9년 전 | 401 | ||
| 7971 | 9년 전 | 472 | ||
| 7970 | 9년 전 | 322 | ||
| 7969 | 9년 전 | 558 | ||
| 7968 | 9년 전 | 401 | ||
| 7967 | 9년 전 | 389 | ||
| 7966 | 9년 전 | 398 | ||
| 7965 |
|
9년 전 | 1033 | |
| 7964 | 9년 전 | 419 | ||
| 7963 | 9년 전 | 427 | ||
| 7962 | 9년 전 | 414 | ||
| 7961 |
전갈자리남자
|
9년 전 | 520 | |
| 7960 | 9년 전 | 987 | ||
| 7959 | 9년 전 | 565 | ||
| 7958 | 9년 전 | 425 | ||
| 7957 | 9년 전 | 377 | ||
| 7956 | 9년 전 | 377 | ||
| 7955 | 9년 전 | 476 | ||
| 7954 | 9년 전 | 405 | ||
| 7953 | 9년 전 | 454 | ||
| 7952 | 9년 전 | 378 | ||
| 7951 | 9년 전 | 516 | ||
| 7950 | 9년 전 | 410 | ||
| 7949 | 9년 전 | 398 | ||
| 7948 | 9년 전 | 339 | ||
| 7947 | 9년 전 | 951 | ||
| 7946 | 9년 전 | 461 | ||
| 7945 | 9년 전 | 417 | ||
| 7944 | 9년 전 | 459 | ||
| 7943 | 9년 전 | 402 | ||
| 7942 | 9년 전 | 420 | ||
| 7941 | 9년 전 | 412 | ||
| 7940 | 9년 전 | 912 | ||
| 7939 | 9년 전 | 383 | ||
| 7938 | 9년 전 | 415 | ||
| 7937 | 9년 전 | 305 | ||
| 7936 | 9년 전 | 898 | ||
| 7935 | 9년 전 | 479 | ||
| 7934 | 9년 전 | 444 | ||
| 7933 | 9년 전 | 558 | ||
| 7932 | 9년 전 | 519 | ||
| 7931 | 9년 전 | 570 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기