当前位置:网站首页>视频直播系统源码,倒计时显示,商品秒杀倒计时
视频直播系统源码,倒计时显示,商品秒杀倒计时
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>
以上就是 视频直播系统源码,倒计时显示,商品秒杀倒计时,更多内容欢迎关注之后的文章
边栏推荐
- Uncover the mystery of SSL and learn how to protect data with SSL
- 等保三级密码复杂度是多少?多久更换一次?
- 多项目开发入门,基础设计 类库项目使用
- 指针链表
- Visualization of loss using tensorboard
- Two methods of shell script parameter passing based on arm5718
- Iso8191 test is mentioned in as 3744.1. Are the two tests the same?
- Several important physical concepts
- PostgreSQL implements batch update, deletion and insertion
- 仅用递归函数和栈操作逆序一个栈
猜你喜欢

Genicam gentl standard ver1.5 (2)

2021年终总结及2022年展望

TFTLCD display experiment of mini plate based on punctual atom stm32

Talking about cloud primitiveness, we have to talk about containers

利用 telegraf influxdb grafana 搭建服务器监控平台

Meichuang was selected into the list of "2022 CCIA top 50 Chinese network security competitiveness"

@Several scenarios of transactional failure

RT-Thread 双向链表(学习笔记)

多项目开发入门,基础设计 类库项目使用

Design a stack with getmin function
随机推荐
Uncertainty principle
机器学习入门笔记
Talking about cloud primitiveness, we have to talk about containers
指针链表
Meichuang data security management platform has obtained the evaluation certificate of "data security product capability verification plan" of the Institute
GenICam GenTL 标准 ver1.5(2)
Using elk to build a log analysis system (I) -- component introduction
Introduction to SQLSERVER database
Analysis of future teacher research ability under steam education framework
Visualization of loss using tensorboard
AspNetCoreRateLimit 速率限制 接口访问限制 限流控制
Particle theory of light (photoelectric effect / Compton effect)
MSc 307 (88) (2010 FTPC code) Part 9 bedding test
Problems with cat and dog queues
27年,微软IE结束了!
RT thread bidirectional linked list (learning notes)
Zipkin 服务链路追踪
Learning notes of digital circuit (II)
PostgreSQL implements batch update, deletion and insertion
GO语言-select语句