js前后翻页????????????
文字是单行循环滚动的,我想加上上一条/下一条的翻页功能,谁帮帮我<script type="text/javascript">
var Scroll = new function(){
this.delay = 3000; //延迟的时间
this.height = 20; //行的高度
this.step = 4; //步长
this.curHeight= 0;
this.stimer = null;
this.timer = null;
this.start = function(){ //开始翻页-调用move方法
this.move();
}
this.move = function(){
var self = this;
//如果显示完一行
if(this.curHeight == this.height)
{
//使用定时器-定时下一行的翻页时间
this.timer = setTimeout(function(){self.move();}, this.delay);
this.curHeight = 0;
//滚动信息已经完毕
if(this.element.scrollTop >= this.element.scrollHeight - this.height){
this.element.scrollTop = 0;
}
return true;
}
this.element.scrollTop += this.step;
this.curHeight += this.step;
//设置自动翻页定时器
this.timer = setTimeout(function(){self.move();}, 30);
}
/*this.pageUp= function(){ //向上翻页
this.element.scrollTop -= (this.step+this.element.scrollTop);
this.curHeight -= (this.step+this.curHeight);
//设置自动翻页定时器
this.timer = setTimeout(function(){self.move();}, 30);
}
this.pageDown= function(){ //向上翻页
this.element.scrollTop += this.step;
this.curHeight += this.step;
//设置自动翻页定时器
this.timer = setTimeout(function(){self.move();}, 30);
}*/
}
</script>
<div style="overflow: hidden; line-height: 20px; height: 20px;" id="divMsg">
<a href="about:blank" onmouseout="Scroll.start()" onmouseover="Scroll.stop()">111111111111</a><br />2222222222222<br />3333333333333<br />
4444444444444<br />55555555555<br />666666666<br />77777777777777<br /></div>
<script type="text/javascript"><!--
Scroll.element = document.getElementById('divMsg');
Scroll.start();
// --></script>