复制代代码如下: <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 のもの*/} <p>//alert(diffY);<br>percent=.1*(diffY-lastScrollY); <br>if(パーセント>0)パーセント=Math.ceil(パーセント); <br>elsepercent=Math.floor(percent); <br>document.getElementById("ad_left").style.top=parseInt(document.getElementById</p> <p>("ad_left").style.top) パーセント "px";<br>document.getElementById("ad_right").style.top=parseInt(document.getElementById</p> <p>("ad_left").style.top) パーセント "px";</p> <p>lastScrollY=lastScrollY パーセント; <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;">关闭</a></div>';<br>var ClosebuttonHtml2 = '<div style="position:Absolute;bottom:0px;right:25px;margin:2px;padding:2px;z-index:2000;"><a href="javascript:void(1);" onclick="hidead(2)" style="color:#ffffff;text-decoration:none;font-size:12px;">关闭</a></div>';<br>ad1=" <div id=/"ad_left/" style='right:10px;POSITION:absolute;TOP:160px;'></div>"<br>ad2="<DIV id=/"ad_right/" style='right:10px;POSITION:absolute;TOP:160px;'><br><a href='tencent://message/?uin=758541860&Menu=yes'><img height='120 ' src='../images/qq.gif' border='0' width='110'></a></div>";<br>document.write(ad1); <br>document.write(ad2); <br>window.setInterval("heartBeat()",1);<br>