复制代码 代码如下: <BR>lastScrollY=0;<BR>function heartBeat(){ <BR>var diffY;<BR>if (document.documentElement && document.documentElement.scrollTop)<BR>diffY = document.documentElement.scrollTop;<BR>else if (document.body)<BR>diffY = document.body.scrollTop<BR>else<BR>{/*Netscape stuff*/} <P>//alert(diffY);<BR>percent=.1*(diffY-lastScrollY); <BR>if(percent>0)percent=Math.ceil(percent); <BR>else percent=Math.floor(percent); <BR>document.getElementById("ad_left").style.top=parseInt(document.getElementById <P>("ad_left").style.top)+percent+"px";<BR>document.getElementById("ad_right").style.top=parseInt(document.getElementById <P>("ad_left").style.top)+percent+"px"; <P>lastScrollY=lastScrollY+percent; <BR>//alert(lastScrollY);<BR>}<BR>function hidead(num)<BR>{<BR>showad = false;<BR>if(num==1)<BR>document.getElementById("ad_left").style.display="none";<BR>else if(num==2)<BR>document.getElementById("ad_right").style.display="none";<BR>}<BR>var ClosebuttonHtml1 = '<div style="position: absolute;bottom:0px;right:25px;margin:2px;padding:2px;z-index:2000;"><a href="javascript:void(0);" onclick="hidead(1)" style="color:#ffffff;text-decoration:none;font-size:12px;">关闭 ';var ClosebuttonHtml2 = '关闭';ad1=""ad2=" ";document.write(ad1); document.write(ad2); window.setInterval("heartBeat()",1);