*PAYING for help*

TrueJewix

Member
Aug 9, 2012
332
21
For some reason my counter won't move, I've tried everything.


<div id="countdown"></div>

<script>
// set the date we're counting down to
var target_date = new Date("Feb 19, 2016").getTime();

// variables for time units
var days, hours, minutes, seconds;

// get tag element
var countdown = document.getElementById("countdown");

// update the tag with id "countdown" every 1 second
setInterval(function () {

// find the amount of "seconds" between now and target
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;

// do some time calculations
days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400;

hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;

minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);

// format countdown string + set tag value
countdown.innerHTML = days + " days " + hours + " hours "
+ minutes + " minutes and " + seconds +" seconds";

}, 1000);
</script>

div#countdown {
margin-left: 109px;
}
 

Synt4x

Member
Jan 13, 2016
77
59
What's the problem? Seem's to work fine for me though, though you did forget to include
HTML:
<style></style>
tags around the
Code:
div#countdown {
margin-left: 109px;
}
code. But I guess you sorted that in your actual code?
 

Users who are viewing this thread

Top