1
rated 0 times
[
4]
[
3]
/ answers: 1 / hits: 57215
/ 12 Years ago, wed, september 5, 2012, 12:00:00
i have some clock script. Everything is fine and it's work perfectly but... i have one problem. If at the clock is set one digit hour or minute like 1:5 clock not adding 0 digit before. This what i'v done but it does't work. Can u help me, much thx?
window.setInterval(function update_clock() {
var currentTime = new Date();
var currentHours = currentTime.getHours();
var currentMinutes = currentTime.getMinutes();
$.ajax({
success: function (clock) {
document.getElementById(hour).firstChild.nodeValue = currentHours;
document.getElementById(minutes).firstChild.nodeValue = currentMinutes;
if (currentMinutes.length == 1) {
currentMinutes = 0 + currentMinutes;
}
}
});
}, 999);
More From » clock