WebClock/clock.js
efrick a53376f57e Cleaned up both the PHP/HTML and JavaScript code.
Removed the orignal PHP date formating. The code now runs so that PHP
will inishilize a view on the page and JS will then update this.
The formating of the Timezone doesn't seem to be consistant acrossed
browsers. And JS doesn't format time with leading zeros for minutes or
seconds which is odd. This may be fixed in a further revision.
2020-03-31 22:15:41 -04:00

15 lines
406 B
JavaScript

window.onload = startInterval;
function startInterval(){
setInterval("startTime();",1000);
}
function startTime(){
var current_time = new Date(),
formated_time = current_time.getHours() + ":"
+ current_time.getMinutes() + ":"
+ current_time.getSeconds();
document.getElementById('time_title').innerHTML = "Time is: " + formated_time;
document.getElementById('time_body').innerHTML = Date();
}