zoukankan      html  css  js  c++  java
  • js打字机效果实现

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>打字机效果</title>
    </head>
    <body>
    <div id="HotNews">

    </div>
    <script type="text/javascript">
    var NewsTime=2000;
    var TextTime=50;
    var newsi=0;
    var txti=0;
    var txttimer;
    var newstimer;
    var newstitle=new Array(); //微博标题
    var newshref=new Array(); //微博链接
    newstitle[0]="健康是身体的本钱";
    newshref[0]="#";
    newstitle[1]="关心身体,就是关心自己";
    newshref[1]="#";
    newstitle[2]="去西藏旅游了";
    newshref[2]="#";
    newstitle[3]="大雨倾盆,很大呀";
    newshref[3]="#";
    function shownew(){
    var endstr="";
    hwnewstr=newstitle[newsi];
    newslink=newshref[newsi];
    if(txti==(hwnewstr.length-1)){
    endstr="";
    }
    if(txti>=hwnewstr.length){
    clearInterval(txttimer);
    clearInterval(newstimer);
    newsi++;
    if(newsi>=newstitle.length){
    newsi=0;

    }
    newstimer=setInterval("shownew()",NewsTime);
    txti=0;
    return;
    }
    clearInterval(txttimer);
    document.getElementById("HotNews").href=newslink;
    document.getElementById("HotNews").innerHTML=hwnewstr.substring(0,txti+1)+endstr;
    txti++;
    txttimer=setInterval("shownew()",TextTime);
    }
    shownew();
    </script>
    </body>
    </html>

  • 相关阅读:
    代码审计中的XSS反射型漏洞
    PHP 代码审计代码执行注入
    4.代码审计之代码注入
    3.代码审计之 命令注入
    2.代码审计之超全局变量
    spring, spring mvc, mybatis整合文件配置详解
    StringUtils方法
    主键与外键
    MySQL面试题
    spring面试题
  • 原文地址:https://www.cnblogs.com/luoguixin/p/6147796.html
Copyright © 2011-2022 走看看