From c95040a2b44e967cbc83d8a11b5a953ec79c2754 Mon Sep 17 00:00:00 2001 From: lio2011 Date: Mon, 23 Oct 2023 19:42:48 +0530 Subject: [PATCH 1/2] Added Countdown Timer #1024 --- Timer/index.html | 17 +++++++++++++++++ Timer/web.js | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Timer/index.html create mode 100644 Timer/web.js diff --git a/Timer/index.html b/Timer/index.html new file mode 100644 index 000000000..894782961 --- /dev/null +++ b/Timer/index.html @@ -0,0 +1,17 @@ + + + + + Document + + +
+

Days
+

Hours
+

Minutes
+

Seconds
+
+ + + + \ No newline at end of file diff --git a/Timer/web.js b/Timer/web.js new file mode 100644 index 000000000..4720760f2 --- /dev/null +++ b/Timer/web.js @@ -0,0 +1,19 @@ +var count = new Date("Oct 24,2023 18:00:00").getTime(); +var x = setInterval(function () { + var now = new Date().getTime(); + var d = count - now; + + var days = Math.floor(d / (1000 * 60 * 60 * 24)); + var hours = Math.floor((d % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + var minutes = Math.floor((d % (1000 * 60 * 60)) / (1000 * 60)); + var seconds = Math.floor((d % (1000 * 60)) / 1000); + + document.getElementById("days").innerHTML = days; + document.getElementById("hours").innerHTML = hours; + document.getElementById("minutes").innerHTML = minutes; + document.getElementById("seconds").innerHTML = seconds; + + if (d <= 0) { + clearInterval(x); + } +}, 1000); From 287974abd7d404b77767cc688549fdd284de5656 Mon Sep 17 00:00:00 2001 From: lio2011 Date: Mon, 23 Oct 2023 19:44:59 +0530 Subject: [PATCH 2/2] changed file structure --- Timer/{ => lio2011}/index.html | 0 Timer/{ => lio2011}/web.js | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Timer/{ => lio2011}/index.html (100%) rename Timer/{ => lio2011}/web.js (100%) diff --git a/Timer/index.html b/Timer/lio2011/index.html similarity index 100% rename from Timer/index.html rename to Timer/lio2011/index.html diff --git a/Timer/web.js b/Timer/lio2011/web.js similarity index 100% rename from Timer/web.js rename to Timer/lio2011/web.js