摘要:<!DOCTYPE html><html><head><title></title><style type="text/css">* {margin:0;padding: 0;}div {font-size:36px; width:1200px; height: 180px; margin:0 auto;
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
* {margin:0;padding: 0;}
div {font-size:36px; width:1200px; height: 180px; margin:0 auto; background: #82d743;line-height:180px; text-align: center; color:#fff;}
</style>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<body>
<div>
<p>51倒計(jì)時(shí):<span></span></p>
</div>
<script type="text/javascript">
$(function(){
function Ro(){
var date = Date.parse("05,01,2019");//得到指定日期的毫秒數(shù)
var d = new Date();
var dd =d.getTime();//得到當(dāng)前毫秒數(shù)
var rd = Math.floor((date-dd)/1000); //得到總秒數(shù)。
var days =Math.floor(rd/86400);
var hours =Math.floor(rd%86400/3600);
var minus =Math.floor((rd%3600)/60);
var second =Math.floor(rd%60);
$('span').text(days+'天'+hours+'小時(shí)'+minus+'分鐘'+second+'秒');
}
setInterval(Ro,1000);
})
</script>
</body>
</html>
批改老師:查無此人批改時(shí)間:2019-04-16 09:52:43
老師總結(jié):完成的不錯(cuò)。js日期一般用在選擇框,比如機(jī)票。繼續(xù)加油。