html+JavaScript開發倒計時源碼

簡單javascript製做2020年元旦倒計時,2020年1月1日時間倒計時代碼。javascript

直接給大家分享源碼吧,記錄一些倒計時,提供與學習和參考
下載連接:https://www.gaowenjx.com/?id=258html

很是好用的東西很是好用的東西很是好用的東西很是好用的東西很是好用的東西很是好用的東西很是好用的東西很是好用的東西java

 

 

<!DOCTYPE html>
<html style="font-size: 85.3333px;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta http-equiv="Cache-Control" content="no-transform">
<meta name="applicable-device" content="mobile">
<meta http-equiv="Cache-Control" content="no-siteapp">
<title>【元旦倒計時】2020新年倒計時_距離2020年還有多少天</title>

<style>
.timebox2{width:640px;background-color:#FCF3E2;padding: 1rem 0;background: url(images/ks_bcg2.png) center center no-repeat;background-size: 100% 100%;}
.timebox2 div,timebox2 span,timebox2 div span{color: #333 !important;}
.timebox2 .timecounter span{color: #333 !important;}
.timetext{width: 100%;text-align: center;}
.timetexttitle{font-size:0.3rem;margin-bottom: 10px;color: #fff;}
.timetextintro{font-size: 0.22rem;margin-bottom: 10px;color: #fff;padding: 0 1.52rem;box-sizing: border-box;}
.timecounter{font-size: 0.6rem;}
.txt{padding: 0 0.2rem;box-sizing:border-box;}
.clearbg5{display: block;clear: both;width: 100%;height: 0.16rem;overflow: hidden;background-color: #eee;}
.txt p{line-height: 30px;margin-top: 0.2rem;}
.txt p img{width: 100%;}
.timecounter span{color: #fff;}
</style>

<body>

<div class="timebox2">
	<div class="timetext">
		<div class="timetexttitle">2020年元旦倒計時</div>
		<div class="timetextintro">元旦時間:2020年1月1日 農曆臘月初七 星期三</div>
		<div class="timetextintro">目前距離2020年元旦還有</div>
		<div class="timecounter">
			<span id="t_d">127 天</span>
			<span id="t_h">10 時</span>
			<span id="t_m">24 分</span>
			<span id="t_s">8 秒</span>
		</div>
	</div>
</div>
<a href="http://www.gaowenjx.com">高文教學網</a>
<script type="text/javascript">
function getRTime() {
	var EndTime = new Date("2020/01/01 00:00:00"); //截止時間
	var NowTime = new Date();
	var t = EndTime.getTime() - NowTime.getTime();
	var d = Math.floor(t / 1000 / 60 / 60 / 24);
	var h = Math.floor(t / 1000 / 60 / 60 % 24);
	var m = Math.floor(t / 1000 / 60 % 60);
	var s = Math.floor(t / 1000 % 60);

	document.getElementById("t_d").innerHTML = d + " 天";
	document.getElementById("t_h").innerHTML = h + " 時";
	document.getElementById("t_m").innerHTML = m + " 分";
	document.getElementById("t_s").innerHTML = s + " 秒";
}
setInterval(getRTime, 1000);
</script>

</body>
</html>
相關文章
相關標籤/搜索