javascript 页面两侧浮动广告代码

来源:互联网 发布:哪个返利网好 知乎 编辑:程序博客网 时间:2024/04/28 18:07
 
<script language=javascript>
var specialcode="<DIV id=searchspe1 style='Z-INDEX: 100; left: 1px; POSITION: absolute; TOP: 50px;'> <image src='' width='30' height='100'></DIV>";
specialcode+="<DIV id=searchspe2 style='Z-INDEX: 100; left: 600px; POSITION: absolute; TOP: 50px;'> <image src='' width='30' height='100'></DIV>";
document.write(specialcode);
lastScrollY=0;
function heartBeat0(){
   diffY=document.body.scrollTop;
   percent=.1*(diffY-lastScrollY);
   if(percent>0)percent=Math.ceil(percent);
   else percent=Math.floor(percent);
    document.all.searchspe1.style.pixelTop+=percent;
    document.all.searchspe2.style.pixelTop+=percent;
    lastScrollY=lastScrollY+percent;
    }
   window.setInterval("heartBeat0()",1);</script>