- 1

Can you fix it?

I want to fix this code, but I dont know how do it? I want the finish resout is look like this - Часът вмомента е: 20:12:57(true time) This is the code: <!DOCTYPE html> <html> <head> <script> function startTime() { var today = new Date(); var h = today.getHours(); var m = today.getMinutes(); var s = today.getSeconds(); m = checkTime(m); s = checkTime(s); document.getElementById('txt').innerHTML = h + ":" + m + ":" + s; var t = setTimeout(startTime, 500); } function checkTime(i) { if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10 return i; } </script> </head> <p>Часът вмомента е <body onload="startTime()"></p> <div id="txt"></div> </body> </html>

13th Dec 2017, 6:39 PM
Veselie Ltd.
Veselie Ltd. - avatar
3 Answers
13th Dec 2017, 7:58 PM
Ranjan Bagri
Ranjan Bagri - avatar
+ 7
Please use the code playground to show us your code so we can see the result.
13th Dec 2017, 7:06 PM
Learnsolo
+ 2
Very tenk you
14th Dec 2017, 11:18 AM
Veselie Ltd.
Veselie Ltd. - avatar