i'm creating a countdown timer using jquery, i refered to a few example here and came out with the following codes. The problem is the time doesn't show, and i can't figure out what is wrong. Been stuck for almost 2 hours..
back code
var day = 1; //countdown time
var start = player.LastActive; // Use UtcNow instead of Now
var endTime = start.AddDays(day); //endTime is a member, not a local variable
Timespan remainingTime = endTime - DateTime.UtcNow;
my javascript
var endTime = '<%= remainingTime%>';
var startTime = '<%= DateTime.UtcNow %>'
$(document).load(function () {
countDown(endTime);
});
function countDown(endTime) {
if (endTime > 0) {
var d = document.getElementById("countDiv");
d.innerHTML = endTime;
setTimeout(function () { countDown(endTime - 1); }, 1000);
}
}
my html
<div id="countDiv" style="float:left;margin-top: 13px; margin-left:5px;"></div>
my goal is to show how long more, for a player to get his daily move : which is a day after the players lastactive time. Can someone enlighten me..thank u