返回会用日期函数的......登陆

会用日期函数的时分秒,及setInterval的用法。

OneZone2019-04-15 15:45:31279

<!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倒计时:<span></span></p>

</div>

<script type="text/javascript">

$(function(){

function Ro(){

var date = Date.parse("05,01,2019");//得到指定日期的毫秒数

var d = new Date();

var dd =d.getTime();//得到当前毫秒数

var rd = Math.floor((date-dd)/1000); //得到总秒数。

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+'小时'+minus+'分钟'+second+'秒');

}

setInterval(Ro,1000);

})

</script>

</body>

</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送