手动控制div内信息上下滚动
来源:互联网 发布:买软件的市场 编辑:程序博客网 时间:2024/04/29 11:00
重新封装了一下原先的div信息自动滚动的代码/特记录如下
<html>
<head>
<title>ScrollDemo</title>
</head>
<body>
<input id="down" type="button" onmousedown="scroll.downScroll()" onmouseup="scroll.stopScroll();"
value="down" />
<input id="up" type="button" onmousedown="scroll.upScroll();" onmouseup="scroll.stopScroll();"
value="up" />
<div id="scrollDiv" style="width: 280px; height: 110px; line-height: 20px; overflow: hidden;
background-color: #eeeeee; font-size: 12px">
1比比谁的“粉丝”(关注者)多?<br>
2看看谁是CSDN最“可爱”的人<br>
3CSDN论坛推出“问专家”功能<br>
4可以让您的问题更快速、高效的得到解决<br>
5Microsoft酷炫应用争霸赛——万元现金等你拿<br>
6最后一季 举报处理建议专用贴(ASP.NET)<br>
7VS.NET开发中的小技巧<br>
8VS.NET 2005中实用的默认键<br>
9部署问题请大家帮忙,分不多了,请大家原谅!<br>
10求CSDN首页的轮流广告代码<br>
11 SLQ语句,时间判断
</div>
<script type="text/javascript">
var $ = function(id){
return document.getElementById(id);
}
function Scroll(){
}
Scroll.prototype={
init:function(scrollobj){
this.scrollBox = scrollobj;
this.scrollBoxHeight = this.scrollBox.clientHeight;
this.scrollBoxInner = this.scrollBox.innerHTML;
this.scrollCol = this.scrolln = 0;
this.scrollBox.innerHTML += "<br>" + this.scrollBoxInner;
this.scrollCol =this.scrollBox.scrollTop;
this.scrolln = 0;
$('up').disabled="disabled";
},
downScroll:function(){
$('up').disabled="";
this.scrollBox.scrollTop = this.scrollCol + this.scrolln;
if(this.scrolln==this.scrollBoxHeight)
{$('down').disabled="disabled";return;}
else
this.scrolln ++;
var o = this;
function m(){o.downScroll();}
this.timer = setTimeout(m,20);
},
upScroll:function(){
$('down').disabled="";
this.scrollBox.scrollTop = this.scrollCol + this.scrolln;
if(this.scrolln==0)
{$('up').disabled="disabled";return;}
else
this.scrolln --;
var o = this;
function m(){o.upScroll();}
this.timer = setTimeout(m,20);
},
stopScroll:function(){
clearTimeout(this.timer);
}
}
var scroll = new Scroll();
scroll.init($('scrollDiv'));
</script>
</body>
</html>
<head>
<title>ScrollDemo</title>
</head>
<body>
<input id="down" type="button" onmousedown="scroll.downScroll()" onmouseup="scroll.stopScroll();"
value="down" />
<input id="up" type="button" onmousedown="scroll.upScroll();" onmouseup="scroll.stopScroll();"
value="up" />
<div id="scrollDiv" style="width: 280px; height: 110px; line-height: 20px; overflow: hidden;
background-color: #eeeeee; font-size: 12px">
1比比谁的“粉丝”(关注者)多?<br>
2看看谁是CSDN最“可爱”的人<br>
3CSDN论坛推出“问专家”功能<br>
4可以让您的问题更快速、高效的得到解决<br>
5Microsoft酷炫应用争霸赛——万元现金等你拿<br>
6最后一季 举报处理建议专用贴(ASP.NET)<br>
7VS.NET开发中的小技巧<br>
8VS.NET 2005中实用的默认键<br>
9部署问题请大家帮忙,分不多了,请大家原谅!<br>
10求CSDN首页的轮流广告代码<br>
11 SLQ语句,时间判断
</div>
<script type="text/javascript">
var $ = function(id){
return document.getElementById(id);
}
function Scroll(){
}
Scroll.prototype={
init:function(scrollobj){
this.scrollBox = scrollobj;
this.scrollBoxHeight = this.scrollBox.clientHeight;
this.scrollBoxInner = this.scrollBox.innerHTML;
this.scrollCol = this.scrolln = 0;
this.scrollBox.innerHTML += "<br>" + this.scrollBoxInner;
this.scrollCol =this.scrollBox.scrollTop;
this.scrolln = 0;
$('up').disabled="disabled";
},
downScroll:function(){
$('up').disabled="";
this.scrollBox.scrollTop = this.scrollCol + this.scrolln;
if(this.scrolln==this.scrollBoxHeight)
{$('down').disabled="disabled";return;}
else
this.scrolln ++;
var o = this;
function m(){o.downScroll();}
this.timer = setTimeout(m,20);
},
upScroll:function(){
$('down').disabled="";
this.scrollBox.scrollTop = this.scrollCol + this.scrolln;
if(this.scrolln==0)
{$('up').disabled="disabled";return;}
else
this.scrolln --;
var o = this;
function m(){o.upScroll();}
this.timer = setTimeout(m,20);
},
stopScroll:function(){
clearTimeout(this.timer);
}
}
var scroll = new Scroll();
scroll.init($('scrollDiv'));
</script>
</body>
</html>
- 手动控制div内信息上下滚动
- js控制上下滚动
- div内容文字上下滚动
- jquery上下循环滚动插件 控制li上下循环滚动
- js 控制 div 滚动
- div滚动条控制
- selenium之 如何控制网页内嵌div中滚动条的滚动
- selenium之 如何控制网页内嵌div中滚动条的滚动
- 层(div)的上下滚动
- 层(div)的上下滚动
- Jquery操作div上下浮动滚动
- div中ul内容逐条上下滚动
- 控制DIV内图片大小
- android通过代码控制ListView上下滚动
- 通过代码控制ListView上下滚动
- JS按钮控制内容上下滚动
- 按钮控制电影图片上下滚动
- html中设置某个区域手动上下滚动
- 判断字符串是否为数字
- document 对象详解
- a=b+(b=a)*0是如何编译
- 使用存储过程的一些小提示!
- Linux下Java工程打包
- 手动控制div内信息上下滚动
- 恐怖的人狼城
- 用js实现菜单导航功能
- Fun.xls. 之惑
- C# 基础需知
- 学习《WF本质论》笔记
- 桌面得SCF
- 关于SOA
- 关于在ehlib的DBGridEh控件中使用过滤功能的方法