当前位置:网站首页>视频直播系统源码,倒计时显示,商品秒杀倒计时
视频直播系统源码,倒计时显示,商品秒杀倒计时
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>
以上就是 视频直播系统源码,倒计时显示,商品秒杀倒计时,更多内容欢迎关注之后的文章
边栏推荐
- In the era of video explosion, who is supporting the high-speed operation of video ecological network?
- 美创数据安全管理平台获信通院“数据安全产品能力验证计划”评测证书
- 指针链表
- Chapter 1 Introduction to bash
- Another option for ERP upgrade, MES system
- Arrangement of basic electrical knowledge (II)
- Particle theory of light (photoelectric effect / Compton effect)
- 第一个.net core MVC项目
- 光伏板怎么申请ASTM E108阻燃测试?
- A summary of my recent situation in June 2022
猜你喜欢
Open the field of maker education and creation
机器学习入门笔记
揭开SSL的神秘面纱,了解如何用SSL保护数据
first. Net core MVC project
The operating mechanism of spectrogram in audio Science
ambari SSLError: Failed to connect. Please check openssl library versions.
阿里P8倾情推荐,Fiddler抓包工具实战篇(一)
Detailed explanation of KVM common commands
Several important physical concepts
Detailed explanation of iptables firewall rules and firewalld firewall rules
随机推荐
leetcode:494. All methods of adding and subtracting operators to the array to get the specified value
Particle theory of light (photoelectric effect / Compton effect)
11_ Deliberate practice and elaboration
In the era of video explosion, who is supporting the high-speed operation of video ecological network?
Moonbeam集成Coin98,给予用户在多链道路上的更多选择
【Linux】【Mysql】ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘
测试/开发程序员真的是青春饭吗?世界是公平的,咱们都凭实力说话......
first. Net core MVC project
Introduction to SQLSERVER database
La norme européenne en 597 - 1 pour les meubles est - elle la même que les deux normes en 597 - 2 pour les ignifuges?
01 MongoDB的概述、应用场景、下载方式、连接方式和发展历史等
The operating mechanism of spectrogram in audio Science
RT thread bidirectional linked list (learning notes)
Learning about DC-DC step-down chip of sy8120i (12V reduced to 3.3V)
Multi project design and development · introduction to class library project
Visualization of loss using tensorboard
Go语言学习教程(十四)
【Linux】【Mysql】ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘
Two methods of shell script parameter passing based on arm5718
Detailed explanation of KVM common commands