批改状态:未批改
老师批语:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>jquery第一课</title>
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
<style>
.content{
width: 1000px;
height: 250px;
background:pink;
color:cornsilk;
text-align: center;
padding-top: 50px;
margin:0 auto;
}
</style>
<script type="text/javascript">
$(function(){
function Ro() {
var d = Date.parse("Feb 05,2019");//返回1970年1月1日到新年午夜的毫秒数
var date =new Date(); //获得当前时间
var dd = date.getTime();//计算当前时间距离1970年1月1日的毫秒数
var rd = Math.floor((d - dd)/1000);//秒数
var days = Math.floor(rd/86400);//天数
var hours = Math.floor(rd % 86400/3600); //取余以后就是不到一天的秒数,在除以3600就是小时数
var minus = Math.floor(rd % 3600/60);//小时取余之后得分钟数
var secos = Math.floor(rd % 60);
$("span").text(days + "/天" + hours + "/小时" + minus + "/分钟" + secos + "/秒")
}
setInterval(Ro,1000);
})
</script>
</head>
<body>
<div class="content">
2019年农历春节倒计时:<span></span>
</div>
</body>
</html>点击 "运行实例" 按钮查看在线实例

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号