Correction status:Uncorrected
Teacher's comments:
<!DOCTYPE html> <html> <head> <title>倒计时</title> <style type="text/css"> *{margin: 0;padding: 0;} div{ font-size: 36px; width: 1200px; height: 180px; margin: 100 auto; background: #82d741; line-height: 180px; text-align: center; color: #fff; } </style> <script type="text/javascript" src="http://ph7.shengqianku.cn/jquery-3.3.1.min.js"></script> </head> <body> <div> <p>2019年清明节倒计时:<span></span></p> </div> <script> $(function(){ function Ro(){ var d=Date.parse("Apr 05,2019") var date=new Date() var dd=date.getTime() var m=Math.floor((d-dd)/1000)//总 var t=Math.floor(m/86400)//天 var h=Math.floor(m%86400/3600)//小时 var i=Math.floor(m%3600/60)//分钟 var s=Math.floor(m%60)//秒 $('span').text(t+"天"+h+"小时"+i+"分钟"+s+"秒") } setInterval(Ro,1000) }) </script> </body> </html>
点击 "运行实例" 按钮查看在线实例