zoukankan      html  css  js  c++  java
  • js代码 简单实现数字滚动增加动效(原)

    <html>
    <body>

    <span>look this:</span><span id="nums">10000</span>

    </body>

    </heml>

    <script type="text/javascript">
    var totalNum = 10000;
    var nums = 0;
    // 调用计时函数
    setTimeout(timedCount(nums),50);

    // 循环计时函数, 多次调用自身函数, nums为被传递的参数
    function timedCount(nums){
    var count = Math.round(totalNum/97);
    nums = nums+count;
    document.getElementById('nums').innerHTML =nums
    // $("#nums").text(nums);
    // 设置条件使停止计时
    if (nums<totalNum) {
    setTimeout(function(){timedCount(nums)},50);
    }else{
    document.getElementById('nums').innerHTML =totalNum
    }
    }


    </script>

  • 相关阅读:
    HDU 1423
    POJ 3264
    POJ 3177
    CodeForces 81A
    SPOJ RATING
    ZOJ 2588
    POJ 1523
    POJ 3667
    递归
    数据结构
  • 原文地址:https://www.cnblogs.com/myJuly/p/10088422.html
Copyright © 2011-2022 走看看