Table 滚动显示

 注意:顯示筆數與所設的(id="demo")行高有關係 
 <div style="padding: 0;margin:0;position: relative ">          
<table width="600px" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="4FBFF9">
        <tr>
                <td width="120px" align="center">业务流水号</td>
                <td width="130px" align="center">业务名称</td>
                <td width="150px" align="center">申请企业名称</td>
                <td width="100px" align="center">申报日期</td>
                <td width="100px" align="center">办理状态</td>
        </tr>
</table>

<div id="demo" style="overflow: hidden; height: 177px;">
        <div id="demo1">
                <table width="600px" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="4FBFF9">
                        <tr>
                                <td width="120px" align="center">2014040200011</td>
                                <td width="130px">测试业务</td>
                                <td width="150px">申请企业名称</td>
                                <td width="100px" align="center">2014-03-13</td>
                                <td width="100px" align="center">在办</td>
                        </tr>
                 <tr>
                                <td width="120px" align="center">2014040200012</td>
                                <td width="130px">测试业务</td>
                                <td width="150px">申请企业名称</td>
                                <td width="100px" align="center">2014-03-13</td>
                                <td width="100px" align="center">在办</td>
                        </tr> <tr>
                                <td width="120px" align="center">2014040200013</td>
                                <td width="130px">测试业务</td>
                                <td width="150px">申请企业名称</td>
                                <td width="100px" align="center">2014-03-134</td>
                                <td width="100px" align="center">在办</td>
                        </tr> <tr>
                                <td width="120px" align="center">2014040200014</td>
                                <td width="130px">测试业务</td>
                                <td width="150px">申请企业名称</td>
                                <td width="100px" align="center">2014-03-13</td>
                                <td width="100px" align="center">在办</td>
                        </tr> <tr>
                                <td width="120px" align="center">2014040200015</td>
                                <td width="130px">测试业务</td>
                                <td width="150px">申请企业名称</td>
                                <td width="100px" align="center">2014-03-13</td>
                                <td width="100px" align="center">在办</td>
                        </tr> <tr>
                                <td width="120px" align="center">2014040200016</td>
                                <td width="130px">测试业务</td>
                                <td width="150px">申请企业名称</td>
                                <td width="100px" align="center">2014-03-13</td>
                                <td width="100px" align="center">在办</td>
                        </tr> <tr>
                                <td width="120px" align="center">2014040200017</td>
                                <td width="130px">测试业务</td>
                                <td width="150px">申请企业名称</td>
                                <td width="100px" align="center">2014-03-13</td>
                                <td width="100px" align="center">在办</td>
                        </tr> <tr>
                                <td width="120px" align="center">2014040200018</td>
                                <td width="130px">测试业务</td>
                                <td width="150px">申请企业名称</td>
                                <td width="100px" align="center">2014-03-13</td>
                                <td width="100px" align="center">在办</td>
                        </tr> <tr>
                                <td width="120px" align="center">2014040200019</td>
                                <td width="130px">测试业务</td>
                                <td width="150px">申请企业名称</td>
                                <td width="100px" align="center">2014-03-13</td>
                                <td width="100px" align="center">在办</td>
                        </tr> 
                </table>
        </div>
        <div id="demo2"></div>
</div>
    </div> 
<script type="text/javascript">
var speed = 50;
demo2.innerHTML = demo1.innerHTML;
function Marquee() {
   
        if (demo2.offsetTop - demo.scrollTop <= 0) { 
                demo.scrollTop -= demo1.offsetHeight;
             
        } else {
                demo.scrollTop++;
               
        }
}
var MyMar = setInterval(Marquee, speed);

demo.onmouseover = function() {
        clearInterval(MyMar);
}

demo.onmouseout = function() {
        MyMar = setInterval(Marquee, speed);
}
</script>

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页