<div id="good" style="width:468px"> 广告代码1<br /> 广告代码2<br /> </div>
<script type=text/javascript> marqueesHeight=60; //广告牌高度 stopscroll=false; with(good){ style.width=0; style.height=marqueesHeight; style.overflowX="visible"; style.overflowY="hidden"; noWrap=true; onmouseover=new Function("stopscroll=true"); onmouseout=new Function("stopscroll=false"); } preTop=0; currentTop=marqueesHeight; stoptime=0; good.innerHTML+=good.innerHTML;
function init_srolltext(){ good.scrollTop=0; setInterval("scrollUp()",1); }init_srolltext();
function scrollUp(){ if(stopscroll==true) return; currentTop+=1; if(currentTop==marqueesHeight+1) { stoptime+=1; currentTop-=1; if(stoptime == 300) // 控制停留时间 100=1秒 { currentTop=0; stoptime=0; } } else { preTop=good.scrollTop; good.scrollTop+=1; if(preTop==good.scrollTop){ good.scrollTop=marqueesHeight; good.scrollTop+=1; } }
} init_srolltext(); </script>
|