倒计时切换网页为灰色代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>倒计时</title> <style> </style> </head> <body> <div> <img src="https://jiubx.com/wp-content/uploads/2020/04/2020040304530377.png" alt=""> </div> <span id="jtime"></span> </body> <script> function j_time() { var jtime = new Date(); var stoptime= new Date("2020/4/4 16:11:00");//结束时间 var shenyu=(stoptime.getTime()-jtime.getTime())/1000; var oDay = parseInt(shenyu/(24*60*60)); var oHours = parseInt(shenyu/(60*60)); var oMinutes = parseInt((shenyu/60)%60); var oSeconds = parseInt(shenyu%60); // console.log(shenyu,oDay,oHours,oMinutes,oSeconds); var jspan=document.getElementById("jtime"); jspan.innerText=oDay+'天'+oHours+'小时'+oMinutes+'分钟'+oSeconds+'秒'; if(shenyu<0){ j_html(); clearInterval(b); jspan.innerText=""; } } function j_html() { var a = document.body.style.filter="grayscale(100%)"; console.log(a); } var b=setInterval(j_time,1000); j_time(); </script> </html>
倒计时切换网页为正常颜色代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>倒计时</title> <style> </style> </head> <body> <div> <img src="https://jiubx.com/wp-content/uploads/2020/04/2020040304530377.png" alt=""> </div> <span id="jtime"></span> </body> <script> function j_time() { var jtime = new Date(); var stoptime= new Date("2020/4/4 16:11:00");//结束时间 var shenyu=(stoptime.getTime()-jtime.getTime())/1000; var oDay = parseInt(shenyu/(24*60*60)); var oHours = parseInt(shenyu/(60*60)); var oMinutes = parseInt((shenyu/60)%60); var oSeconds = parseInt(shenyu%60); // console.log(shenyu,oDay,oHours,oMinutes,oSeconds); var jspan=document.getElementById("jtime"); jspan.innerText=oDay+'天'+oHours+'小时'+oMinutes+'分钟'+oSeconds+'秒'; if(shenyu<0){ j_html(); clearInterval(b); jspan.innerText=""; } } function j_html() { var a = document.body.style.filter="grayscale(0%)"; console.log(a); } var b=setInterval(j_time,1000); j_time(); </script> </html>
加群入久伴博客官方微信群
加入久伴官方微信群有啥优势?
1.文章内部资源由于时间久远可能失效,加群,群内可以第一时间反馈
2.网站中教程不一定适用任何人,加群可以第一时间咨询并解决您得疑惑
3.你游荡于互联网,也需要群体,加群一起互动交流,畅所欲言
扫描下方二维码即可加入交流讨论

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。