Template:Kyoto/small countdown
From 2014.igem.org
(Difference between revisions)
(Created page with "<html> <a id="kyoto_alert" target="_blank" href="https://2013.igem.org/Team:Kyoto/TimeLimit">count down</a> <style type="text/css"> #kyoto_alert { position: fixed; top: 30px; ...") |
|||
Line 29: | Line 29: | ||
date.getUTCSeconds() | date.getUTCSeconds() | ||
); | ); | ||
- | var freeze = Date.UTC(2014, | + | var freeze = Date.UTC(2014, 10, 18, 4, 0, 0); |
time = (freeze - time)/1000; | time = (freeze - time)/1000; | ||
if (time < 1 * 3600) { | if (time < 1 * 3600) { | ||
Line 36: | Line 36: | ||
countdown.style.color = "#ff0"; | countdown.style.color = "#ff0"; | ||
} | } | ||
- | if (time >= 0) | + | if (time < 0) { |
- | var second = ('0' + (time % 60)).slice(-2); | + | countdown.style.display = "none"; |
- | + | } else { | |
- | + | var str; | |
- | + | if (time > 4 * 24 * 3600) { | |
- | + | var odd = (time%60)%2; | |
- | + | time = Math.floor(time / 60); | |
- | + | var minute = ('0' + (time % 60)).slice(-2); | |
+ | time = Math.floor(time / 60); | ||
+ | var hour = ('0' + (time)).slice(-2); | ||
+ | time = Math.floor(time / 24); | ||
+ | day = ('0' + (time)).slice(-2); | ||
+ | str = day + " : " + hour + " : " + minute; | ||
+ | } else { | ||
+ | var second = ('0' + (time % 60)).slice(-2); | ||
+ | time = Math.floor(time / 60); | ||
+ | var minute = ('0' + (time % 60)).slice(-2); | ||
+ | time = Math.floor(time / 60); | ||
+ | var hour = ('0' + (time)).slice(-2); | ||
+ | str = hour + " : " + minute + " : " + second; | ||
+ | } | ||
countdown.innerText = str; | countdown.innerText = str; | ||
countdown.style.display = "block"; | countdown.style.display = "block"; | ||
- | |||
- | |||
} | } | ||
}, 200); | }, 200); | ||
</script> | </script> | ||
</html> | </html> |