| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 597 人关注过本帖
标题:js前后翻页????????????
只看楼主 加入收藏
chenyl_99
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-10-30
收藏
 问题点数:0 回复次数:0 
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>
搜索更多相关主题的帖子: javascript function null 
2009-10-30 14:33
快速回复:js前后翻页????????????
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011405 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved