显示在1024*768下,随滚动条而上下移动,韩国网站经常用到这种效果,不影响页面美观
<!-- http://www.webjx.com/ -->
<!-- bbs http://www.webjx.com/bbs-->
<!-- 把下列代码加到<body>区域内 -->
<SCRIPT language=JavaScript>
// more javascript from http://www.webjx.com
<!--
self.onError=null;
currentX = 0;
currentY = 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 = 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("heartBeat()",1);
//-->
</SCRIPT>
<DIV id=floater
style="Z-INDEX: 1; LEFT: 807px; WIDTH: 145px; POSITION: absolute; TOP: 0px; HEIGHT: 350px">
<TABLE cellSpacing=0 cellPadding=0 width=145 border=0>
<TBODY>
<TR>
<TD height=70> </TD></TR>
<TR>
<TD><IMG
height=55 src="/img/200406301.jpg" width=145 border=0></TD>
</TR>
<TR>
<TD height=65><IMG
height=55 src="/img/200406302.jpg" width=145
border=0></TD>
</TR></TR>
<TR>
<TD vAlign=top height=57><IMG
height=52 src="/img/200406303.jpg" width=145 border=0></TD>
</TR>
</TBODY></TABLE></DIV>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]