最新文字上下滚动并暂停

以下是三零网为大家整理的最新文字上下滚动并暂停的文章,希望大家能够喜欢!

以下是代码片段:



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-CN">
<meta name="generator" content="editplus">
<meta name="author" content="dron">
<meta name="keywords" content="dron">
<meta name="description" content="dron">
<title>游戏人滚动字幕类</title>
<style type="text/css">
 *
 {
  font-size:12px;
 }
 #scrollBox
 {
  width:250px;
  height:20px;
  line-height:20px;
  overflow:hidden;
  background-color:#eee;
 }
 #scrollBox2
 {
  width:280px;
  height:80px;
  line-height:20px;
  overflow:hidden;
  background-color:#eee;
 }
</style>
</head>
<body>
单行例子:(每屏一行)<br><br>
<div id="scrollBox">
中国去年进口原油 11%来自上合成员<br />
美:中国对台湾立场 似转趋和缓<br />
美制裁四家中国公司 中方表示强烈不满<br />
中伊关系加温 大陆波斯餐厅开幕
</div>
<br>多行例子:(每屏四行)<br><br>
<div id="scrollBox2">
为何暂停UN登记武器转让 中方做解释<br>
追悼空军运输机遇难者 ***送花圈<br>
中国控制互联网?外交部发言人驳斥<br>
美国移民局逮2179人 包括1华人蛇头<br>
奇男子能嚼咽双刃刀片 用鼻子喝茶<br>
男子持塑料玩具枪 劫走四十多吨铜(图)<br>
餐馆当街宰小猫做肉丸 场面血腥(图)<br>
男子软禁妻子近5年 称是替其驱妖魔<br>
男子杀死同居女友 与腐尸共宿八天<br>
年轻妻子欲***救夫 88篇日记感人<br>
曾志伟父亲节双喜临门 获美荣誉博士
</div>
<script type="text/javascript">
/*******************************************
  游戏人滚动字幕类 2006-06-16 修改
  This JavaScript was writen by Dron.
  @2003-2008 Ucren.com All rights reserved.
*******************************************/
function Dron_ScrollBox(uid)
{
 this.scrollBox = document.getElementById(uid);
 this.scrollBoxHeight = this.scrollBox.clientHeight;
 this.scrollBoxInner = this.scrollBox.innerHTML;
 this.scrollCol = this.scrolln = 0;
 this.setScroll = function ()
 {
  this.scrollBox.scrollTop = this.scrollCol + this.scrolln;
  if(this.scrolln==this.scrollBoxHeight)
   return this.addScroll()
  else
   this.scrolln ++;
  var o = this;
  function m(){o.setScroll();}
  setTimeout(m,20);
 }
 this.addScroll = function ()
 {
  this.scrollBox.innerHTML += "<br>" + this.scrollBoxInner;
  this.scrollCol = this.scrollBox.scrollTop;
  this.scrolln = 0;
  var o = this;
  function m(){o.setScroll();}
  setTimeout(m,1000);
 }
 this.init = this.addScroll;
}
//类的调用方法,可多个,只要你内存允许
new Dron_ScrollBox("scrollBox").init();
new Dron_ScrollBox("scrollBox2").init();
</script>
</body>
</html>

转载来自:http://www.q3060.com/list3/list115/18.html