Template:Kyoto/header
From 2013.igem.org
(Difference between revisions)
Line 18: | Line 18: | ||
<html> | <html> | ||
- | < | + | <a id="kyoto_alert" target="_blank" href="https://2013.igem.org/Team:Kyoto/TimeLimit">count down</a> |
<style type="text/css"> | <style type="text/css"> | ||
#kyoto_alert { | #kyoto_alert { | ||
Line 29: | Line 29: | ||
line-height: 30px; | line-height: 30px; | ||
font-size: 30px; | font-size: 30px; | ||
+ | color: #ddd; | ||
+ | text-decoration: none; | ||
padding: 30px 10px; | padding: 30px 10px; | ||
display: none; | display: none; | ||
- | |||
- | |||
- | |||
} | } | ||
</style> | </style> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
+ | var timer = setInterval(function() { | ||
var countdown = document.getElementById("kyoto_alert"); | var countdown = document.getElementById("kyoto_alert"); | ||
var date = new Date(); | var date = new Date(); | ||
Line 48: | Line 48: | ||
); | ); | ||
var freeze = Date.UTC(2013, 8, 28, 4, 0, 0); | var freeze = Date.UTC(2013, 8, 28, 4, 0, 0); | ||
- | + | time = (freeze - time)/1000; | |
+ | if (time < 1 * 3600) { | ||
+ | alert(); | ||
+ | countdown.style.color = "#f00"; | ||
+ | } else if (time < 24 * 3600) { | ||
+ | countdown.style.color = "#ff0"; | ||
+ | } | ||
+ | if (time >= 0) { | ||
+ | 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); | ||
+ | var str = hour + " : " + minute + " : " + second; | ||
+ | countdown.innerText = str; | ||
countdown.style.display = "block"; | countdown.style.display = "block"; | ||
+ | } else { | ||
+ | countdown.style.display = "none"; | ||
} | } | ||
+ | }, 200); | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 13:32, 26 September 2013