Team:Uppsala/synbioday
From 2013.igem.org
(Difference between revisions)
Line 43: | Line 43: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
var domesday = new Date(2013,08,19,00,00,01); | var domesday = new Date(2013,08,19,00,00,01); | ||
- | + | var sec = 1000; | |
- | + | var min = sec * 60; | |
- | + | var h = min * 60; | |
- | + | var d = h * 24; | |
- | + | var timer; | |
- | + | ||
- | + | function domedaystimer() { | |
- | + | var present = new Date(); | |
- | + | var distance = domesday.getTime() - present.getTime(); | |
- | + | ||
- | + | ||
- | + | if (distance < 0) { | |
- | + | clearInterval(timer); | |
+ | document.getElementById('countdown').innerHTML = 'DAMDAAMDAAAAAAM!'; | ||
- | + | return; | |
- | + | } | |
- | + | var days = Math.floor(distance/ d); | |
- | + | var hours = Math.floor((distance % d) / h); | |
- | + | var minutes = Math.floor((distance % h) / min); | |
- | + | var seconds = Math.floor((distance % min) / sec); | |
- | + | var output = '<table class="timer"><td class="time">' + days + '</br>day</td><td class="space">:</td><td class="time">' + hours + '</br>hour</td><td class="space">:</td><td class="time">' + minutes +'</br>min</td><td class="space">:</td><td class="time">' + seconds +'</br>sec</td></table>'; | |
- | + | document.getElementById('countdown').innerHTML = output; | |
} | } |
Revision as of 00:32, 16 August 2013