<!DOCTYPE html>
<html>
<head>
<script>
function showDateTime() {
var today = new Date();
var hour = today.getHours();
var minute = today.getMinutes();
var second = today.getSeconds();
minute = checkTime(minute);
second = checkTime(second);
document.getElementById('datetime').innerHTML =
hour + " : " + minute + " : " + second;
var time= setTimeout(startTime, 500);
}
function checkTime(i) {
if (i < 10) {i = "0" + i};
return i;
}
</script>
</head>
<body onload="showDateTime()">
<div id="datetime"></div>
</body>
</html>
No comments:
Post a Comment