From 97a0ea584428886b1d6eb06fc074f07ce96a3e02 Mon Sep 17 00:00:00 2001 From: thewarrior1220 Date: Wed, 16 Feb 2022 10:15:56 +0100 Subject: [PATCH] Timer added --- index2.html | 3 ++- style.css | 0 timer.js | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 style.css create mode 100644 timer.js diff --git a/index2.html b/index2.html index fb9b759..98eaf2b 100644 --- a/index2.html +++ b/index2.html @@ -5,7 +5,8 @@ - + DSZC Beregszaszi diff --git a/style.css b/style.css new file mode 100644 index 0000000..e69de29 diff --git a/timer.js b/timer.js new file mode 100644 index 0000000..c63056d --- /dev/null +++ b/timer.js @@ -0,0 +1,22 @@ +function updateTimer(){ + future = Date.parse("feb 22, 2022 14:00:00"); + now = new Date(); + diff = future - now; + + days = Math.floor(diff / (1000 * 60 * 60 * 24)); + hours = Math.floor(diff / (1000 * 60 * 60)); + mins = Math.floor(diff / (1000 * 60)); + secs = Math.floor(diff / 1000); + + d = days; + h = hours - days * 24; + m = mins - hours * 60; + s = secs - mins * 60; + + document.getElementById("timer").innerHTML = + '
' + d + 'Nap
' + + '
' + h + 'Ora
' + + '
' + m + 'Perc
' + + '
' + s + 'Masodperc
'; +} +setInterval('updateTimer()', 1000); \ No newline at end of file