• title向左_右滚动效果


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
     <title>我爱自己想</title>
      <script type="text/javascript">
        //效果:向左,向右滚动.
        //setInterval事件.
        var dir='left';


        setInterval(function (){

           if(dir==='left'){
          //实现向左滚动
            var firstDoc=document.title.charAt(0);    
            var others=document.title.substring(1,document.title.length);
            document.title=others+firstDoc;
       
           }else if(dir==='right'){

           var lastDoc=document.title.charAt(document.title.length-1);
        
           var others=document.title.substring(0,document.title.length-1);
        
           document.title=lastDoc+others;    }
          },1000);
       
       //为两个button注册单击事件
         window.onload=function (){
          //left:
          document.getElementById('idLeft').onclick=function (){
            dir='left';
            }
         //right;
           document.getElementById('idright').onclick=function (){
            dir='right';
          }
       }
      </script>
     </head>
       
     <body>   
        <input type="button" name="name" value="left" id="idLeft" onclick="leftMoths()"></input>
        <input type="button" name="name" value="right" id="idright" onclick="rightMoths()"></input>

     </body>
    </html>

  • 相关阅读:
    关于“.bash_profile”和“.bashrc”区别的总结
    更新CentOS的SQLite版本
    关于 javadoc
    IDEA一些功能的记录
    Java 反射机制
    Java 注解
    有趣的代码实例
    Bash
    Java 枚举
    Java 零星知识实时补充
  • 原文地址:https://www.cnblogs.com/nqsan/p/3182895.html
Copyright © 2020-2023  润新知