时间:2021-07-01 10:21:17 帮助过:7人阅读
具体代码如下所示:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <span class="timespan"></span> </body> <script src="libs/jquery-1.11.3.js"></script> <script> var starttime = new Date("2017/11/20"); setInterval(function () { var nowtime = new Date(); var time = starttime - nowtime; var day = parseInt(time / 1000 / 60 / 60 / 24); var hour = parseInt(time / 1000 / 60 / 60 % 24); var minute = parseInt(time / 1000 / 60 % 60); var seconds = parseInt(time / 1000 % 60); $('.timespan').html(day + "天" + hour + "小时" + minute + "分钟" + seconds + "秒"); }, 1000); </script> </html>
以上所述是小编给大家介绍的jQuery倒计时代码(超简单),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!