In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to achieve the countdown effect of JavaScript". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Implementation code:
Countdown-(yisu.com) * {margin: 0; padding:0;} p {font-size: 80px; text-align: center;} p span {color: red;} p span.time {color: black} body {padding-top:200px;}
There's still room for 2022.
Var oSpan = document.getElementsByTagName ('span') [0]; function tow (n) {return n > = 0 & & n < 10?' 0' + n:'+ n;} function getDate () {var nowDate = newDate (); / / get date object var oldTime = nowDate.getTime (); / / the number of milliseconds from 1970 var newDate = newDate ('2022-1-1 00001'); var newTime = newDate.getTime () / / milliseconds from 2022 to 1970 var second = Math.floor ((newTime-oldTime) / 1000); / / seconds from the future time to the present var day = Math.floor (second / 86400); / / the integer part represents the day There are 24'60'60 '86400 seconds in a day; second = second% 86400 impact / remainder represents the remaining seconds; var hour = Math.floor (second / 3600); / / integer parts represent hours; second% = 3600; / / remainder represents remaining seconds Var minute = Math.floor (second / 60); second% = 60; var str = tow (day) + 'days' + tow (hour) + 'hours' + tow (minute) + 'minutes' + tow (second) + 'seconds'; oSpann [XSS _ clean] = str;} getDate (); setInterval (getDate, 1000) This is the end of the content of "how to achieve the countdown effect of JavaScript". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.