• jquery/js实现一个网页同时调用多个倒计时(最新的)


    <div class="time countdown_1" data-time="1449429731">  
        <span class="t_h_1">00</span>  
        <i class="lay_line">:</i>  
        <span class="t_m_1">00</span>  
        <i class="lay_line">:</i>  
        <span class="t_s_1">00</span>  
    </div>  
    <div class="time countdown_2" data-time="1449456731">  
        <span class="t_h_2">00</span>  
        <i class="lay_line">:</i>  
        <span class="t_m_2">00</span>  
        <i class="lay_line">:</i>  
        <span class="t_s_2">00</span>  
      
    </div>  
    //js2  
    var plugJs={  
        stamp:0,  
        tid:1,  
        stampnow:'<?php echo NOW_TIME;?>',//统一开始时间戳  
        intervalTime:function(){  
            if(plugJs.stamp > 0){  
                var day = Math.floor(plugJs.stamp / (60 * 60 * 24));  
                var hour = Math.floor(plugJs.stamp / (60 * 60)) - (day * 24);  
                var minute = Math.floor(plugJs.stamp / 60) - (day * 24 * 60) - (hour * 60);  
                var second = Math.floor(plugJs.stamp) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);  
                  
                if (day <= 9) day = '0' + day;  
                if (hour <= 9) hour = '0' + hour;  
                if (minute <= 9) minute = '0' + minute;  
                if (second <= 9) second = '0' + second;  
                jQuery('.t_h_'+plugJs.tid).html(hour);  
                jQuery('.t_m_'+plugJs.tid).html(minute);  
                jQuery('.t_s_'+plugJs.tid).html(second);  
                plugJs.stamp--;  
                setTimeout('if(typeof(plugJs.intervalTime) == "function"){plugJs.intervalTime();}',1000);  
            }  
        },  
        timer:function (stampend,tid){  
            plugJs.stamp = parseInt(stampend)-parseInt(plugJs.stampnow);//剩余时间戳  
            setTimeout('if(typeof(plugJs.intervalTime) == "function"){plugJs.intervalTime();}',1000);  
        }  
    };  
    jQuery(document).ready(function(){  
        var stampend = parseInt(jQuery('.countdown_1').attr('data-time'));//灵活读取表里的结束时间戳  
        plugJs.timer(stampend,'1');  
    });  
  • 相关阅读:
    String与int转换,Java当中
    微信小程序首页的上一个页面栈和当前页面栈
    windows中用命令行实现http下载网络文件
    jmeter
    java
    java
    java请求python的x-www-form-urlencoded接口
    java
    getopts/getopt命令行参数处理
    failed command: READ FPDMA QUEUED
  • 原文地址:https://www.cnblogs.com/ahu666/p/6149837.html
Copyright © 2020-2023  润新知