A useHTML
Write countdown static interface that you can modifyt.setHours(22);
,t.setMinutes(0);
和 t.setSeconds(0);
Adjust the daily countdown time. You can also change the description. It’s easy to find the description, right? You can also modify itlet start_time2 = new Date('2020/6/1 00:00:00')
To describe an important date.
<! doctypehtml>
<html>
<head>
<meta charset="utf-8">
<title>Medusa countdown</title>
<script src="https://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<style>
.time1..time2 {
color: brown;
font-size: 45px
}
.description {
color: darkorange;
font-size: 45px;
}
</style>
</head>
<body>
<div class="Medusa">
<div>
<span class="description1 description"></span>
<span class="time1"></span>
</div>
<div>
<span class="description2 description"></span>
<span class="time2"></span>
</div>
</div>
<script>
setInterval(function () {
let start_time1 = null;
let scrip = null;
let t = new Date(a); t.setHours(22);
t.setMinutes(0);
t.setSeconds(0);
if (new Date().getHours() > 18) {
start_time1 = t + 24 * 60 * 60 * 1000;
scrip = 'Not till tomorrow.'
} else {
start_time1 = t
scrip = 'Till the end of the day.'
}
let start_time2 = new Date('2020/6/1 00:00:00')
let now_time = new Date(a);let time1 = start_time1 - now_time;
let time2 = start_time2 - now_time;
$('.description1').html(scrip);
let hour1 = parseInt(time1 / 1000 / 60 / 60 % 24);
let minute1 = parseInt(time1 / 1000 / 60 % 60);
let seconds1 = parseInt(time1 / 1000 % 60);
$('.time1').html(hour1 + "When" + minute1 + "Points" + seconds1 + "Seconds");
let day2 = parseInt(time2 / 1000 / 60 / 60 / 24);
let hour2 = parseInt(time2 / 1000 / 60 / 60 % 24);
let minute2 = parseInt(time2 / 1000 / 60 % 60);
let seconds2 = parseInt(time2 / 1000 % 60);
$('.description2').html('There is still time for Children's Day');
$('.time2').html(day2 + "Day" + hour2 + "When" + minute2 + "Points" + seconds2 + "Seconds");
}, 1000);
</script>
</body>
</html>
Copy the code