当前位置:网站首页>视频直播系统源码,倒计时显示,商品秒杀倒计时
视频直播系统源码,倒计时显示,商品秒杀倒计时
2022-06-28 03:44:00 【云豹网络科技】
视频直播系统源码,倒计时显示,商品秒杀倒计时
样式:
<style>
body {
background-color: gray;
}
ul {
list-style: none;
}
ul li {
border: 1px solid black;
float: left;
width: 50px;
height: 50px;
line-height: 50px;
text-align: center;
border-radius: 5px;
margin-right: 10px;
}
ul li:nth-child(1) {
width: 150px;
}
ul li:nth-child(5) {
margin: 0;
}
</style>
结构:
<ul>
<li>开奖时间倒计时</li>
<li id="d"></li>
<li id="h"></li>
<li id="c"></li>
<li id="s"></li>
</ul>
行为:
```javascript
<script>
// 初始化时间变量
var d = 0,
h = 0,
c = 0,
s = 0;
// 设置结束时间
var endTime = new Date('2021-11-24 19:49:50').getTime();
//设置定时器 dingshiqi =》 定时器
var dingshiqi = setInterval(action, 1000);
function action() {
// 获取当前时间
var now_time = new Date().getTime();
// 距离结束剩余的时间 结束时间-现在时间
var lase_time = (endTime - now_time) / 1000;
// 判断是否结束倒计时
if (lase_time > 0) {
//计算剩余天数
d = parseInt(lase_time / (60 * 60 * 24));
// 计算剩余小时数
h = parseInt((lase_time / (60 * 60)) % 24);
// 计算剩余分钟数:
c = parseInt((lase_time / 60) % 60);
// 计算当前秒数
s = parseInt(lase_time % 60);
//设置输出的格式:(小于10的情况,前面加0)
d = d < 10 ? '0' + d : d;
h = h < 10 ? '0' + h : h;
c = c < 10 ? '0' + c : c;
s = s < 10 ? '0' + s : s;
} else {
clearInterval(dingshiqi);
d = h = c = s = '00';
}
// 把数据传输到html中
document.getElementById('d').innerHTML = d + '天';
document.getElementById('h').innerHTML = h + '时';
document.getElementById('c').innerHTML = c + '分';
document.getElementById('s').innerHTML = s + '秒';
}
</script>
以上就是 视频直播系统源码,倒计时显示,商品秒杀倒计时,更多内容欢迎关注之后的文章
边栏推荐
- MSC 307(88) (2010 FTPC Code)第2部分烟气和毒性测试
- Component splitting practice
- 2022年6月对自己近况的一次总结
- 2021 year end summary and 2022 outlook
- ELK 搭建日志分析系统 + Zipkin服务链路追踪整合
- TFTLCD display experiment of mini plate based on punctual atom stm32
- RT thread bidirectional linked list (learning notes)
- 机器学习入门笔记
- How to apply for ASTM E108 flame retardant test for photovoltaic panels?
- 利用ELK 搭建日志分析系统(三)—— 安全认证
猜你喜欢

How to learn a programming language systematically| Dark horse programmer

@Transactional失效的几种场景

Introduction to SQLSERVER database

Understanding and learning of parental delegation mechanism

品达通用权限系统(Day 5~Day 6)

Uncover the mystery of SSL and learn how to protect data with SSL

Learning about DC-DC step-down chip of sy8120i (12V reduced to 3.3V)

02 MongoDB数据类型、重要概念以及shell常用指令

美创数据安全管理平台获信通院“数据安全产品能力验证计划”评测证书

Pinda general permission system (day 5~day 6)
随机推荐
gcd最大公约数
内卷、躺平与中年危机的相关思考
ERP升级的另一种选择,MES系统
歐洲家具EN 597-1 跟EN 597-2兩個阻燃標准一樣嗎?
用一个栈实现另一个栈的排序
Tiktok practice ~ pay attention to bloggers
僅用遞歸函數和棧操作逆序一個棧
有关函数模板的那些小知识-.-
From zero to one, I will teach you to build a "search by text and map" search service (I)
Understanding and learning of parental delegation mechanism
10:00面试,10:02就出来了 ,问的实在是太...
美创入选“2022 CCIA中国网络安全竞争力50强”榜单
Problems with cat and dog queues
TFTLCD display experiment of mini plate based on punctual atom stm32
Reading notes of top performance version 2 (II) -- CPU monitoring
欧洲家具EN 597-1 跟EN 597-2两个阻燃标准一样吗?
Arrangement of basic electrical knowledge (II)
Particle theory of light (photoelectric effect / Compton effect)
等保三级密码复杂度是多少?多久更换一次?
2021年终总结及2022年展望