Team:Uppsala/synbioday
From 2013.igem.org
(Difference between revisions)
Line 9: | Line 9: | ||
<title>Uppsala iGEM 2013</title> | <title>Uppsala iGEM 2013</title> | ||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> | <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> | ||
+ | |||
<style type="text/css"> | <style type="text/css"> | ||
.timer | .timer | ||
Line 43: | Line 44: | ||
<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 sec = 1000; |
- | var h = min * 60; | + | var min = sec * 60; |
- | var d = h * 24; | + | var h = min * 60; |
- | var timer; | + | var d = h * 24; |
+ | var timer; | ||
- | function domedaystimer() { | + | function domedaystimer() { |
- | var present = new Date(); | + | var present = new Date(); |
- | var distance = domesday.getTime() - present.getTime(); | + | var distance = domesday.getTime() - present.getTime(); |
+ | |||
+ | if (distance < 0) { | ||
- | + | clearInterval(timer); | |
- | + | document.getElementById('countdown').innerHTML = 'DAMDAAMDAAAAAAM!'; | |
- | + | ||
- | + | return; | |
- | + | } | |
- | var days = Math.floor(distance/ d); | + | var days = Math.floor(distance/ d); |
- | var hours = Math.floor((distance % d) / h); | + | var hours = Math.floor((distance % d) / h); |
- | var minutes = Math.floor((distance % h) / min); | + | var minutes = Math.floor((distance % h) / min); |
- | var seconds = Math.floor((distance % min) / sec); | + | 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>'; | + | 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; | + | document.getElementById('countdown').innerHTML = output; |
} | } |
Revision as of 00:34, 16 August 2013