javascript - Remove '-' symbols when counting down from Java script code -
i using script work out hours mins , seconds date, fine past dates continues count up, when date in future - symbol attached front , don't want this, how prevent being applied
function uptime(countto) {       = new date();       difference = (now-countto);        days=math.floor(difference/(60*60*1000*24)*1);       years=math.floor(days/365);       hours=math.floor((difference%(60*60*1000*24))/(60*60*1000)*1);       mins=math.floor(((difference%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);       secs=math.floor((((difference%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);        //document.getelementbyid('years').firstchild.nodevalue = years;        document.getelementbyid('live-hour').innerhtml = hours;       document.getelementbyid('live-min').innerhtml = mins;       document.getelementbyid('live-sec').innerhtml = secs;        cleartimeout(uptime.to);       uptime.to=settimeout(function(){ uptime(countto); },1000); 
use math.abs absolute value of difference.
difference = math.abs(now-countto); 
Comments
Post a Comment