javascript 文字向上滚动 函数及例子

80酷酷网    80kuku.com

  javascript|函数|向上滚动以下是例子和函数:
把下面的COPY过去看看效果就知道了,主要是每隔1秒向上滚动一行,然后停顿一秒!在供求信息,新闻,等里面的应用比较多
<div id="icefable11" cellSpacing=0 cellPadding=0 width='300' border=0><tr>
<td height='20'><a href='../display/Productview.asp?id=15353' class='40' target=_blank>粗纺呢绒</a></td>
<td height='20'><a href='../display/Productview.asp?id=15022' class='40' target=_blank>圣麻纱线</a></td></tr><tr>
<td height='20'><a href='../display/Productview.asp?id=15002' class='40' target=_blank>沙发坐垫</a></td>
<td height='20'><a href='../display/Productview.asp?id=14998' class='40' target=_blank>汽车靠垫</a></td></tr><tr>
<td height='20'><a href='../display/Productview.asp?id=14995' class='40' target=_blank>床毯</a></td>
<td height='20'><a href='../display/Productview.asp?id=14964' class='40' target=_blank>汽车座垫</a></td></tr><tr>
<td height='20'><a href='../display/Productview.asp?id=14963' class='40' target=_blank>汽车靠垫</a></td>
<td height='20'><a href='../display/Productview.asp?id=14962' class='40' target=_blank>皮毛汽车用品</a></td></tr><tr>
<td height='20'><a href='../display/Productview.asp?id=14919' class='40' target=_blank>晚装珠袋</a></td>
<td height='20'><a href='../display/Productview.asp?id=14961' class='40' target=_blank>皮毛床毯</a></td></tr><tr>
</tr></table></div>
    <div id="icefable21" language=javascript>
function init_srolltext(num){
marqueesHeight=20;
eval('stopscroll'+num+'=false;')
eval('icefable1'+num+'.scrollTop=0;')
eval('icefable1'+num+'.style.width=0;')
eval('icefable1'+num+'.style.height=marqueesHeight;')
eval('icefable1'+num+'.style.overflowX="visible";')
eval('icefable1'+num+'.style.overflowY="hidden";')
eval('icefable1'+num+'.noWrap=true;')
eval('icefable1'+num+'.onmouseover=new Function("stopscroll'+num+'=true");')
eval('icefable1'+num+'.onmouseout=new Function("stopscroll'+num+'=false");')
eval('preTop'+num+'=0; ')
eval('currentTop'+num+'=0;')
eval('stoptime'+num+'=0;')
eval('icefable2'+num+'.innerHTML="";')
eval('icefable2'+num+'.innerHTML+=icefable1'+num+'.innerHTML;') 
eval('icefable1'+num+'.innerHTML=icefable2'+num+'.innerHTML+icefable2'+num+'.innerHTML;') 
eval('setInterval("scrollUp'+num+'()",20);')
}
preTop1=0; currentTop1=0; stoptime1=0;
function scrollUp1(){
  if(stopscroll1==true) return;
  currentTop1+=1;
  if(currentTop1==21){
   stoptime1+=1;
   currentTop1-=1;
   if(stoptime1==80){
    currentTop1=0;
    stoptime1=0;
   }
  }else{
   preTop1=icefable11.scrollTop;
   icefable11.scrollTop+=1;
   if(icefable11.scrollTop==preTop1){
     preTop1=0; currentTop1=0; stoptime1=0;icefable11.scrollTop=0
   }
  }
}
init_srolltext(1);
</script>


分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: