Easy and Simple Digital Clock
1 post
Page 1 of 1
In Action - http://jsbin.com/IriqOcI/1/
View/Edit code - http://jsbin.com/IriqOcI/1/edit
Full Code:
View/Edit code - http://jsbin.com/IriqOcI/1/edit
Full Code:
Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>Digital Clock</title>
<script>
// Define a function to display the current time
function displayTime() {
var elt = document.getElementById('clock');
var now = new Date();
elt.innerHTML = now.toLocaleTimeString();
setTimeout(displayTime, 1000);
}
window.onload = displayTime;
</script>
<style>
#clock {
font: bold 1.5em sans;
}
</style>
</head>
<body>
<span id='clock'></span>
</body>
</html>
1 post
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023