diff options
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/liveClock.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/public/js/liveClock.js b/public/js/liveClock.js new file mode 100644 index 0000000..07c9eae --- /dev/null +++ b/public/js/liveClock.js @@ -0,0 +1,10 @@ +function time() { + var span = document.getElementById("clock"); + var d = new Date(); + var s = d.getSeconds(); + var m = d.getMinutes(); + var h = d.getHours(); + span.textContent = + ("0" + h).substr(-2) + ":" + ("0" + m).substr(-2) + ":" + ("0" + s).substr(-2); +} +setInterval(time, 1000); |