한국어
<HTML> <HEAD> <META http-equiv='Content-Type' content='text/html; charset=gb2312'> <TITLE>닫기 버튼과 함께 페이지에 표시되는 마우스 이동 가능 레이어, 멋진 효과</ TITLE> </HEAD> <BODY> <STYLE type=text/css> #floater { LEFT: 400px; TOP: 120px VISIBILITY: WIDTH: 160px } </STYLE> <DIV align=center id=floater style="HEIGHT: 98px; WIDTH: 240px;"> <TABLE bgColor=#deefef border=1 borderColor=#008000 borderColorDark=#00ff00 borderColorLight=#ff00ff cellPadding=2 cellSpacing =1 width= "240"> <TBODY> <TR> <TD width="100%"> <P align=center>웹사이트 구축 아카데미<BR>JavaScript 칼럼에 오신 것을 환영합니다! </P></TD></TR> <TR> <TD width="100%"> 웹사이트 구축 아카데미에 오신 것을 환영합니다. 의견이나 제안 사항이 있으면 언제든지 알려주십시오. 저희의 성장에 최선을 다해 도와드리겠습니다. ! ! <BR> 좋은 제안이나 의견이 있으면 저에게 편지를 보내주세요. 좋은 예가 있으면 상담하고 배우길 바랍니다. </TD></TR></TBODY></TABLE></DIV> <SCRIPT 언어=JavaScript> self.onError=null; currentX = currentY = 0; whichIt = null; NS = (document.layers) ? 1 : 0; IE = (document.all) ? <!-- STALKER CODE --> function heartBeat() { diffY = document.body.scrollTop ; diffX = document.body.scrollLeft; } if(NS) { diffY = self.pageYOffset; } if(diffY != lastScrollY) { 퍼센트 = .1 * (diffY - lastScrollY); > 0) 퍼센트 = Math.ceil(퍼센트); else 퍼센트 = Math.floor(퍼센트); if(IE) document.all.floater.style.pixelTop += 퍼센트 if(NS) document.floater.top += 퍼센트; lastScrollY = lastScrollY + 퍼센트; } if(diffX != lastScrollX) { 퍼센트 = .1 * (diffX - lastScrollX); if(퍼센트 > 0) 퍼센트 = Math.floor( 퍼센트); if(IE) document.all.floater.style.pixelLeft += 퍼센트; if(NS) document.floater.left += 퍼센트; lastScrollX = lastScrollX + 퍼센트 } <!-- /STALKER CODE -- > <!-- 드래그 드롭 코드 --> function checkFocus(x,y) { 스토커x = document.floater.pageX; 스토커리 = document.floater.pageY; 스토커폭 = document.floater.clip.width = document.floater .clip.height; if( (x > 스토커x && x < (stalkerx+stalkerwidth)) && (y > 스토커리 && y < (stalkery+stalkerheight))) return true; else return false; (IE) { whichIt = event.srcElement; while (whichIt.id.indexOf("floater") == -1) { whichIt = whichIt.parentElement; if (whichIt == null) { return true } } .pixelLeft = whichIt.offsetLeft; whichIt.style.pixelTop = whichIt.offsetTop; currentX = (event.clientX + document.body.scrollLeft); currentY = (event.clientY + document.body.scrollTop); CaptureEvents(Event.MOUSEMOVE); if(checkFocus (e.pageX,e.pageY)) { whichIt = document.floater;talkerTouchedX = e.pageX-document.floater.pageX; ; } } true를 반환합니다. } function moveIt(e) { if (whichIt == null) { return false; } if(IE) { newX = (event.clientX + document.body.scrollLeft); + document.body.scrollTop); distanceX = (newY - currentY); currentY = newY; whichIt.style.pixelTop += distanceY; if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop; if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body. scrollLeft; if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20; if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style. pixelHeight - 5; event.returnValue = false; } else { whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY); if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self. pageXOffset; if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset; if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17) ) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17; if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17 )) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17; return false;} return false } function dropIt() { whichIt = null if(NS); (Event.MOUSEMOVE); return true; } <!-- 드래그 드롭 코드 --> if(NS) { window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN) window.onmousedown = moveIt; window.onmouseup = dropIt; } if(IE) { document.onmousedown = moveIt; document.onmouseup = dropIt; } if(NS || IE) action = window.setInterval("heartBeat()", 1) </SCRIPT> </BODY></HTML>