+ 1

<!DOCTYPE html> What is wrong with this 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 < 010) {i = "0" + i}; return i;

21st Dec 2017, 8:55 PM
Ahmed Mohamed Aden
2 Antworten
+ 6
Is this your complete code or just a snippet? As Iman said, you haven't closed the checkTime function but if this is the complete code it's missing plenty of other things. Can you make your code public and add the link?
22nd Dec 2017, 1:11 AM
Duncan
Duncan - avatar
+ 1
You should close the checkTime function I guess
21st Dec 2017, 9:32 PM
Iman Jamaatlou
Iman Jamaatlou - avatar