zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    C# 解析js方法,并调用js方法
    Net 面试题_代码
    最近小项目总结 2013.5.3
    程序集生成失败 引用的程序集“Interop.MSScriptControl”没有强名称
    Vs 使用 (快捷等)
    Ildasm.exe 反汇编程序使用
    MSSQL_1
    [异常] Asp.net 中异常处理
    Net 面试题_理论(总结网上流传的)
    反射
  • 原文地址:https://www.cnblogs.com/nqsan/p/3182895.html
Copyright © 2011-2022 走看看