js实现滚动效果

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML XMLns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>多列文字循环滚动-www.codefans.net</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gbk">
<style type="text/CSS">
ul {
    padding-right: 0px;
    padding-left: 0px;
    padding-bottom: 0px;
    margin: 0px;
    padding-top: 0px
}
#announcement {
    width:100%;
    background:url(img/menu_bg.gif) repeat;
    overflow: hidden;
}
#announcement div {
    border: #e6e6e6 1px solid;
    padding:0px 10px 0px 10px;
    overflow-y:hidden;
    line-height: 24px;
    height: 24px
}
#announcement li {
    font-size: 12px;
    float: left;
    list-style-type: none;
    margin-right: 20px;
    padding-left: 10px;
    background: url(img/arrow_right.gif) no-repeat 0px 50%;
    white-space: nowrap
}
#announcement a {
    text-decoration: none;
}
#announcement a:hover {
    text-decoration:underline;
}
</style>
</HEAD>
<BODY>
<DIV id=announcement onMouseOver="if(!anncount) {clearTimeout(annst);annst = 0}" onMouseOut="if(!annst) annst = setTimeout(’announcementScroll()’, anndelay);">
  <DIV id=announcementbody>
    <UL>
      <li><a href="/soft/4596.shtml" target="_blank">jQuery 类似腾讯网的图片幻灯特效(可自动播放)</a></li><li><a href="/soft/4591.shtml" target="_blank">VB版增强型Windows任务管理器</a></li><li><a href="/soft/4589.shtml" target="_blank">JQuery Tip多风格链接提示框</a></li><li><a href="/soft/4584.shtml" target="_blank">VC++动态加载、调用smtp.dll发邮件示例</a></li><li><a href="/soft/4583.shtml" target="_blank">VC++连连看游戏源码附外挂</a></li><li><a href="/soft/4579.shtml" target="_blank">基于API的VB HOOK钩子拦截程序</a></li><li><a href="/soft/4577.shtml" target="_blank">VB 操作系统的一些常用小技巧集</a></li><li><a href="/soft/4563.shtml" target="_blank">xTree 标准的WEB菜单树(树形菜单)</a></li>
    </UL>
  </DIV>
</DIV>
<script type="text/JavaScript">
function $(id)
{
   return document.getElementById(id);
}
var anndelay = 3000;
var anncount = 0;
var annheight = 24;
var annst = 0;
function announcementScroll()
{
   if( ! annst)
   {
      $(’announcementbody’).innerHTML += ’<br style="clear: both" />’ + $(’announcementbody’).innerHTML;
      $(’announcementbody’).scrollTop = 0;
      if($(’announcementbody’).scrollHeight > annheight * 3)
      {
         annst = setTimeout(’announcementScroll()’, anndelay);
      }
      else
      {
         $(’announcement’).onmouseover = $(’announcement’).onmouseout = null;
      }
      return;
   }
   if(anncount == annheight)
   {
      if($(’announcementbody’).scrollHeight - annheight <= $(’announcementbody’).scrollTop)
      {
         $(’announcementbody’).scrollTop = $(’announcementbody’).scrollHeight / 2 - annheight;
      }
      anncount = 0;
      annst = setTimeout(’announcementScroll()’, anndelay);
   }
   else
   {
      $(’announcementbody’).scrollTop ++ ;
      anncount ++ ;
      annst = setTimeout(’announcementScroll()’, 10);
   }
}
announcementScroll();
</script>
</BODY>
</HTML>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值