複製程式碼程式碼如下: <BR>lastScrollY=0;<BR>function heartBeat(){ <BR>var diffY;<BR>if (document.documentElement && document.documentElement.scrollTop)<BR>diffY = document.documentElement.scrollTop)<BR>diffdt. <BR>else if (document.body)<BR>diffY = document.body.scrollTop<BR>else{/*Netscape 內容*/}<P> <BR>//alert(diffY);<BR>百分比=.1*(diffY-lastScrollY); <BR>if(百分比>0)percent=Math.ceil(百分比); <BR>其他百分比=Math. floor(百分比); document.getElementById("ad_left").style.top=parseInt(document.getElementById<P> <BR>("ad_left").style.top) 百分比 "px";document.getElementById("ad_right").style.top=parseInt(document.getElementById<P> ("ad_left").style.top) 百分比 "px";<P> <BR>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="位置:絕對;底部:0px;右:25px;邊距:2px;填充: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);