+ 1
I need to add features to my stop watch
Hi guys I have created this stop watch however i need to add two things 1 is the stop time whenever i click stop 2 is the current time which reads my system time Can you help? 😎 https://code.sololearn.com/WNIBuWpQ56Up/?ref=app https://code.sololearn.com/WNIBuWpQ56Up/?ref=app
14 ответов
+ 5
You could create a table, and use insertAdjacentHTML to update the elapsed times into table rows.
Check out the code
https://code.sololearn.com/Wr0V54pu60L2/?ref=app
ps I corrected a reset button bug.
+ 2
by using the system time you can store that in a variable and on each update grab the current system time and simple subtraction will give you the time elapsed and place that value in your label.
+ 2
this code will demonstrate how to get and use the data object for the current date. also if you wanted to add a pause button all you would have to do is have it update the variable storing your start time on resume and it should work perfectly.
+ 2
I'm getting the same values for stopped and elapsed times
+ 2
take a look at the code I posted it will show you how to do minutes and such I have them all broken down separately
+ 2
Really thank you guys, you all have been a great help ❤️🌹🌹🌹🌹🌹
+ 1
Also please check line 84
I want only the hours minutes and seconds
I do not want the date day and time etc
0
I didn't see a problem with the stop button. It worked perfectly every time I tried it.
Local system time can be gotten via this method.
https://stackoverflow.com/questions/10659523/how-to-get-the-exact-local-time-of-client
0
Hay
Thanks for the comment, maybe i didn't clarify enough
What i meant i have timelabel already
I need to additional time labels
One captures the time I clicked stop
Second one capture my system time(i will try ur method)
0
Ids could be anything. You could use timLabel, timeLbl, time, label, time1, time2, etc. I'd use timer for your stop time, since it is working as a timer (stopWatch could work too.) I'd use systemTime for your second.
0
Oh sorry again 😁
Let me explain clearly
Once you click start the watch start counting, so this counter is considered as (elapsed time)
Once i click stop, it freezes on the time i stopped in
What i want, i need the stopped time to be recorded and displayed in a different box.
So if i click start again
I'll have two boxes
Elapsed and stop
0
so add an elapsed label. Personally, I'd add a second h1 to store it.
0
Many thanks guys
I just did something, can you check the following code and run it
https://code.sololearn.com/WXB548k7464x/?ref=app