正文 1256字数 85,330阅读

<p class="nnqqqgggss">抢购开始时间剩余:<span id="day_show"></span>天<span id="hour_show"></span>小时<span id="minute_show"></span>分钟<span id="second_show"></span>秒</p> <script> //倒计时 var intDiff = parseInt('<?php echo ($info['qgstime']-time());?>');//倒计时总秒数量 function timer(intDiff){ window.setInterval(function(){ var day=0, hour=0, minute=0, second=0;//时间默认值 if(intDiff > 0){ day = Math.floor(intDiff / (60 * 60 * 24)); hour = Math.floor(intDiff / (60 * 60)) - (day * 24); minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60); second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60); } if (minute <= 9) minute = '0' + minute; if (second <= 9) second = '0' + second; $('#day_show').html(day); $('#hour_show').html(hour); $('#minute_show').html(minute); $('#second_show').html(second); if(intDiff==0) location.href = '<?php echo $_SESSION['dangqian_url'];?>'; intDiff--; }, 1000); } $(function(){ timer(intDiff); }); //end </script>
Run code
Cut to clipboard