Click here to Skip to main content
15,916,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I had a external javascript file with a function inside for running a timer countdown in which the file is executing as expected. I have concatenated minutes with mins and seconds with secs. This mins and secs are moving when seconds and minutes reduce. This exteranl Javascript called in c# asp.net web application

What I have tried:

document.getElementById("timer").innerHTML = "Time Left " + min.toString() + " mins " + " : " + sec.toString() + " secs ";


How to stop moving this mins and secs when timer is running. Please anybody suggest me thanks in advance
Posted
Updated 28-Oct-18 2:06am

1 solution

Pad the minutes and seconds values with a leading 0 if they're less than 10.

09 mins : 09 secs


It also seems to me that if you simply displayed the time remaining without any words, it would still be completely readable (and you could include hours, even if you never need the value:

Time Left: 00:00:00
 
Share this answer
 
v3
Comments
Member 8583441 29-Oct-18 2:28am    
Yeah it's done when minutes and seconds less than 10 "0" will be added to minutes and seconds before the number. But it moving how to achieve this. This movement is done at every 9th second and 1st second i.e, for example 49 seconds or 39 seconds and 31 seconds or 21 seconds or 51 seconds or 41 seconds or 11 seconds movement happening
#realJSOP 29-Oct-18 7:02am    
Change the font for that data to be a non-proportional font.
Member 8583441 29-Oct-18 7:29am    
Hi5! thanks a lot John Simmons sir it worked as expected by changing the font-family in css

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900