abstract:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <script src="https://code.jquery.com/jquery-3.1.1.min.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <style type="text/css"> .box1{width: 800px;height: 600px;margin: 0 auto;background-color: #ccc;text-align: center;line-height: 600px;font-family: 微软雅黑;} </style> </head> <body> <script type="text/javascript"> $(function(){ function Ro(){ var d=Date.parse("Feb 05,2019") var data=new Date() var dd=data.getTime() var xj=Math.floor((d-dd)/1000) var tian=Math.floor(xj/86400) var shi=Math.floor(xj%86400/3600) var feng=Math.floor(xj%3600/60) var miao=Math.floor(xj%60) $("span").text(tian+"天"+shi+"时"+feng+"分"+miao+"秒").css('color', '#CD919E'); } setInterval(Ro,1000);
}) </script> <div> <div> 2019年农历春节倒计时:<span></span> </div> </div> </body> </html> <!-- <script type="text/javascript"> $(function(){ function Ro(){ var d=Date.parse("Feb 05,2019")//返回1970年1月1日至2019年5月4日的毫秒数 var data=new Date() var dd=data.getTime() var rd=Math.floor((d-dd)/1000) var tian=Math.floor(rd /86400) var shi=Math.floor(rd %86400/3600) var feng=Math.floor(rd %3600/60) var miao=Math.floor(rd %60) $("span").text(tian+"天"+shi+"时"+feng+"分"+miao+"秒") } setInterval(Ro,1000); }) </script> -->
Correcting teacher:天蓬老师Correction time:2019-01-24 08:56:21
Teacher's summary:setInterval(Ro,1000);, 如果到期了, 是不是还要清除掉这个定时器?