Andy's Blog » » 兼容IE和FireFox的间隔滚动代码

兼容IE和FireFox的间隔滚动代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>21Andy.com - 兼容IE和FireFox的间隔滚动代码</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
* { font-size: 12px; font-family: Verdana,Tahoma,Arial; padding: 0; margin: 0; }
body { padding: 30px; }
a { color: #000; text-decoration: none; }
a:hover { color: #F60; }
#andyscroll {
    overflow: hidden;
    height: 18px;
    background: #E8F8F8;
    padding: 0 10px;
}
#scrollmessage {
    float: left;
    text-align: left;
}
#scrollmessage li {
    line-height: 18px;
}
-->

</style>
</head>
<body>
 
<div id="andyscroll">
<div id="scrollmessage">
 
<ul>
    
<li><a href="http://www.21andy.com/">21Andy.com 国内首个XHTML+CSS购物车</a></li>
    
<li><a href="http://www.tctea.com/">TCtea.com 铁观音全球直销网站即将启动,敬请关注!</a></li>
 
</ul>
</div>
</div>
 
<script type="text/javascript">
<!--
try{
  var marqueesHeight = 18;
  var stopscroll     = false;
 
  var scrollElem = document.getElementById("andyscroll");
  with(scrollElem){
    style.width     = 300;
    style.height    = marqueesHeight;
    style.overflow  = 'hidden';
    noWrap          = true;
  }
 
  scrollElem.onmouseover = new Function('stopscroll = true');
  scrollElem.onmouseout  = new Function('stopscroll = false');
 
  var preTop     = 0;
  var currentTop = 0;
  var stoptime   = 0;
 
      var leftElem = document.getElementById("scrollmessage");
 
  scrollElem.appendChild(leftElem.cloneNode(true));
 
      
  init_srolltext();
 
}catch(e) {}
 
function init_srolltext(){
  scrollElem.scrollTop = 0;
  setInterval('scrollUp()', 15);
}
 
function scrollUp(){
  if(stopscroll) return;
  currentTop += 1;
  if(currentTop == 19) {
    stoptime += 1;
    currentTop -= 1;
    if(stoptime == 180) {
      currentTop = 0;
      stoptime = 0;
    }
  }else{
    preTop = scrollElem.scrollTop;
    scrollElem.scrollTop += 1;
    if(preTop == scrollElem.scrollTop){
      scrollElem.scrollTop = 0;
      scrollElem.scrollTop += 1;
    }
  }
}
//-->

</script>
</body>
</html>

Incoming search terms:

Tags:

本文地址: http://www.21andy.com/new/20050925/87.html

1 评论 to “PHP开源CMS之MODx”

  1. BulletTime 于 2007-12-22 23:21:01 发表:

    请问这段代码改成横向滚动应该如何修改?