Team:Uppsala/synbioday

From 2013.igem.org

(Difference between revisions)
Line 12: Line 12:
</style>
</style>
 +
<script type="text/javascript">
 +
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;
 +
 +
    }
 +
 +
timer = setInterval(domedaystimer, 1000);
 +
</script>
</head>
</head>

Revision as of 19:43, 22 August 2013