한국어
<!-- http://www.downcodes.com --> <!-- 完整的HTML代码如下: --> <html> <head> <title>跟随滚动条而滚动的广告条</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <STYLE media=screen type=text/css> #floater { 위치: 절대; 가시성: 가시성; 너비: 10px; Z-INDEX: 10 } </STYLE> <script 언어="JavaScript"> <!-- function MM_reloadPage(init) { //Nav4의 크기가 조정되면 창을 다시 로드합니다. if (init==true) with (navigator) {if ( (appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=내부 높이; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); // --> </script> </head> <body bgcolor="#FFFFFF" text="#000000" > <div id="floater" style="position:absolute; left:436px; top:60px; 너비:152px; 높이:178px; z-index:12"><img border=0 src="/u/info_img/2009-06/20/1455_logo.gif" title=怎么样看到效果了吧!>< /div> <SCRIPT 언어=JavaScript> self.onError=null; 현재X = 현재Y = 0; whichIt = null; lastScrollX = 0; lastScrollY = 0; NS = (document.layers) ? 1:0; IE = (document.all) ? 1:0; <!-- 스토커 코드 --> function heartBeat() { if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; } if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; } if(diffY != lastScrollY) { 퍼센트 = .1 * (diffY - lastScrollY); if(퍼센트 > 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.ceil(퍼센트); else 퍼센트 = Math.floor(퍼센트); if(IE) document.all.floater.style.pixelLeft += 퍼센트; if(NS) document.floater.left += 퍼센트; lastScrollX = lastScrollX + 퍼센트; } } <!-- /STALKER CODE --> <!-- 코드 드래그 鼠标拖放事件--> function checkFocus(x,y) {talkerx = 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; 그렇지 않으면 false를 반환합니다. } 함수 GrabIt(e) { if(IE) { whichIt = event.srcElement; while (whichIt.id.indexOf("floater") == -1) { whichIt = whichIt.parentElement; if (whichIt == null) { true를 반환; } } whichIt.style.pixelLeft = whichIt.offsetLeft; whichIt.style.pixelTop = whichIt.offsetTop; currentX = (event.clientX + document.body.scrollLeft); currentY = (event.clientY + document.body.scrollTop); } else { window.captureEvents(Event.MOUSEMOVE); if(checkFocus (e.pageX,e.pageY)) { whichIt = document.floater; StalkerTouchedX = e.pageX-document.floater.pageX; StalkerTouchedY = e.pageY-document.floater.pageY; } } true를 반환합니다. } function moveIt(e) { if (whichIt == null) { return false; } if(IE) { newX = (event.clientX + document.body.scrollLeft); newY = (event.clientY + document.body.scrollTop); distanceX = (newX - 현재X); distanceY = (newY - 현재Y); 현재X = newX; 현재Y = 신규Y; whichIt.style.pixelLeft += 거리X; whichIt.style.pixelTop += 거리Y; 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. 픽셀 높이 - 5; event.returnValue = 거짓; } 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 ; 거짓을 반환; } 거짓을 반환; } 함수 dropIt() { whichIt = null; if(NS) window.releaseEvents (Event.MOUSEMOVE); 사실을 반환; } <!-- 드래그 드롭 코드 鼠标拖放事件--> if(NS) { window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN); window.onmousedown=grabIt; window.onmousemove = moveIt; window.onmouseup = dropIt; } if(IE) { document.onmousedown = GrabIt; document.onmousemove = moveIt; document.onmouseup = dropIt; } if(NS || IE) action = window.setInterval("heartBeat()",1); </SCRIPT> <font size="7" color="#FF0000">跟随滚动条而滚动적广告条</font><br> <font size="4" color="#FF0000">(跟随滚动적의 이름:floater,必须使用该name称,跟随滚动,以及拖放属性) </font><br> <br> </body> </html>