zoukankan      html  css  js  c++  java
  • javascript 文字滚动

    1.向上滚动

    <div id="ntice" style="overflow:hidden;275px; height :196px; margin-top:4px;">
         
    <div id="ntice1" >
           
    <ul>
                         
    <li>内容</li>
                          
           
    </ul>
           
    </div>
         
    <div  id="ntice2"></div> 
        
    </div>
    <script language="javascript" type ="text/javascript"> 
    var speed=50
    ntice2.innerHTML
    =ntice1.innerHTML 
    function Marquee(){ 
    if(ntice2.offsetTop-ntice.scrollTop<=0
    ntice.scrollTop
    -=ntice1.offsetHeight 
    else
    ntice.scrollTop
    ++ 


    var MyMar=setInterval(Marquee,speed) 
    ntice.onmouseover
    =function() {clearInterval(MyMar)} 
    ntice.onmouseout
    =function() {MyMar=setInterval(Marquee,speed)} 
    </script>

    2.左滚动

    <div  id="demo" style="overflow:hidden;850px;height:100px;">
         
    <table>
            
    <tr>
                
    <td id="demo1">
                   
    <table >
                   
    <tr>
                      
    <td>滚动内容</td>
                  
    <tr>
                
    </table>
                
                
    </td>
             
                
    <td id="demo2"></td>
                
            
    </tr>
         
    </table>
      
    </div>
    <script   language="JavaScript" type="text/javascript">
                 
    var speed=30
                 demo2.innerHTML
    =demo1.innerHTML
                 
    function Marquee(){
                 
    if(demo2.offsetWidth-demo.scrollLeft<=0)
                 demo.scrollLeft
    -=demo1.offsetWidth
                 
    else{
                 demo.scrollLeft
    ++
                 }
                 }
                 
    var MyMar=setInterval(Marquee,speed)
                 demo.onmouseover
    =function() {clearInterval(MyMar)}
                 demo.onmouseout
    =function() {MyMar=setInterval(Marquee,speed)}
    </script>
  • 相关阅读:
    redis:aof恢复与rdb服务器间迁移
    redis的主从服务器配置
    redis:消息发布与订阅频道
    redis:hash哈希类型的操作
    redis:order set有序集合类型的操作(有序集合)
    redis:set集合类型的操作(无序集合)
    redis:list列表类型的操作
    C#之多线程
    C# 操作FTP
    C# 导出导入TXT文件
  • 原文地址:https://www.cnblogs.com/ac1985482/p/1487582.html
Copyright © 2011-2022 走看看