js实现倒计时
来源:互联网 发布:mac chrome 导出插件 编辑:程序博客网 时间:2024/06/18 15:29
$(function () {
var sec_str = "<%=promotion_second %>";
if (parseInt(sec_str) < 0) {
timer(sec_str.substring(1));
}
else {
timer(sec_str);
}
});
//倒计时
function timer(intDiff) {
$('#hour_show').html("");
$('#minute_show').html("");
$('#second_show').html("");
time_str = window.setInterval(function () {
var day = 0,
hour = 0,
minute = 0,
second = 0;
if (intDiff > 0) {
hour = Math.floor(intDiff / 3600);
minute = Math.floor((intDiff % 3600) / 60);
second = Math.floor(intDiff % 60);
}
if (hour <= 9) hour = '0' + hour;
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
$('#hour_show').html(hour);
$('#minute_show').html(minute);
$('#second_show').html(second);
intDiff--;
}, 1000);
}
阅读全文
0 0
- JS实现倒计时
- js实现倒计时
- js实现考试倒计时
- js实现考试倒计时
- JS实现网站倒计时
- js+php实现倒计时
- JS实现倒计时
- JS 实现时间倒计时
- js实现倒计时
- js实现倒计时功能
- js实现倒计时
- JS实现商品倒计时
- js实现倒计时功能
- js实现倒计时
- js实现倒计时功能
- js实现倒计时效果
- 纯js实现倒计时
- js实现倒计时功能
- 一个经典的智力题
- iterator()
- 图片旋转问题(指针旋转问题)
- 页面置换算法
- Android双进程守护
- js实现倒计时
- Excel中将时间格式转化成时间戳格式
- leetcode_Two Sum
- Java中堆,栈,堆栈的区别
- opencv waitKey用法 目标追踪 控制程序暂停 开始
- C++中extern关键字使用
- 【LeetCode】 162. Find Peak Element
- Linux 开机流程及boot loader
- Rational Rose 2007安装