现在的位置: 首页 > 综合 > 正文

文字循环向上滚动

2013年08月06日 ⁄ 综合 ⁄ 共 1042字 ⁄ 字号 评论关闭

 

<!--一行一行的向上滚动-->
<html>
<head>
<title>[代码]文字循环向上滚动效果</title>
<style type="text/css">
#infozone{font-size:12px;color:#aa6;overflow:hidden;width:200px;height:20px;}
#infozone div{height:20px;line-height:20px;white-space:nowrap;overflow:hidden;}
</style>
<script type="text/javascript">
window.onload=function()
{
 var o=document.getElementById('infozone');
 window.setInterval(function(){scrollup(o,20,0);},2000);
}

function scrollup(o,d,c)
{
 if(d==c){
  var t=o.firstChild.cloneNode(true);
  o.removeChild(o.firstChild);
  o.appendChild(t);
  t.style.marginTop=o.firstChild.style.marginTop='0px';
 }
 else{
  var s=3,c=c+s,l=(c>=d?c-d:0);
  o.firstChild.style.marginTop=-c+l+'px';
  window.setTimeout(function(){scrollup(o,d,c-l)},100);
 }
}
</script>
</head>
<body>
<div id="infozone">
<div><a href="http://www.92mk.com" target="_blank">名客网</a></div>
<div><a href="http://http://liujianfeng.92mk.com" target="_blank">名客小筑</a></div>
<div><a href="http://www.92mk.com" target="_blank">名客网</a></div>
<div><a href="http://http://liujianfeng.92mk.com" target="_blank">名客小筑</a></div>
</div>
</body>
</html>
 

抱歉!评论已关闭.