博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
js实现倒计时
阅读量:7033 次
发布时间:2019-06-28

本文共 1075 字,大约阅读时间需要 3 分钟。

  

  

//倒计时8分钟    var getTime=sessionStorage.getItem("zicetime");    var intDiff = parseInt(getTime * 60);//倒计时总秒数量    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+'秒');        intDiff--;        // if(intDiff==50){
// alert(123) // } }, 1000); } $(function(){ timer(intDiff); });

 

转载于:https://www.cnblogs.com/weiyf/p/8706458.html

你可能感兴趣的文章
多客户端上传服务器文档使用scp命令不需要输入密码
查看>>
Node.js的安装,以及测试环境
查看>>
ZSH--agnoster主题安装
查看>>
日常shell命令收集
查看>>
自定义异常
查看>>
我的友情链接
查看>>
Python中的random模块
查看>>
用的较为舒服的时间插件jQuery DateTimePicker
查看>>
Windows8浅谈之Metro与经典Windows界面
查看>>
OpenLDAP的安装与基本配置(一)
查看>>
Dell(戴尔)电脑恢复BIOS出厂设置的方法
查看>>
VMware Horizon View Config Tool 用户使用手册之一 -- VCT介绍和安装之前的准备
查看>>
桥接和路由模式区别
查看>>
黑马程序员-Java基础加强之反射
查看>>
汇编学习——使用Linux系统调用
查看>>
PagerTabStrip简单使用方式2
查看>>
SHELL脚本基础讲解
查看>>
PHP 数据库命令行的使用
查看>>
有赞公告设置
查看>>
win7系统开机遇到reboot and select proper boot device错误解决方法
查看>>