<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
//<!-- STALKER CODE -->
function fnScrollButton() {
if(IE) {
diffY = document.body.scrollTop;
diffX = 0;
}

if(NS) {
diffY = self.pageYOffset; diffX = self.pageXOffset;
}

if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelTop += percent;
if(NS) document.floater.top += percent;
lastScrollY = lastScrollY + percent;
}

if(diffX != lastScrollX) {
percent = .1 * (diffX - lastScrollX);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelLeft += percent;
if(NS) document.floater.top += percent;
lastScrollY = lastScrollY + percent;
}
}

if(NS || IE) action = window.setInterval("fnScrollButton()",1);
//-->

</SCRIPT>

// table 안에 넣어줄 div (실제 쓰이는 버튼)

<div id="floater" style="position:absolute; left:758; top:150; z-index:1"> // 화면에 따라 left, top 을 정해준다.
<img src="<%=RequestUtils.getPageLink(request,"/img")%>/scroll_print.gif" onclick="javascript:window.print();" style="cursor:hand">
</div>

'JavaScript' 카테고리의 다른 글

Javascript Trim 함수  (0) 2008.08.25
트림기능  (0) 2008.07.25
자바스크립트 골라서 쓰기  (0) 2008.07.24
Javascript Event 일람  (0) 2008.03.01
스크립트로 해당 태그에 이벤트 추가/삭제  (0) 2007.12.28
Posted by 퓨전마법사
,