<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
<head>
<!--Quelle: http://www.tutorials.de/javascript-ajax/240723-digitale-uhr-javascript.html#post1253651-->
<title>Time</title>
<script type="text/javascript">
<!--
function start() {
time();
window.setInterval("time()", 1000);
}
function time() {
var now = new Date();
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
thetime = (hours < 10) ? "0" + hours + ":" : hours + ":";
thetime += (minutes < 10) ? "0" + minutes + ":" : minutes + ":";
thetime += (seconds < 10) ? "0" + seconds : seconds;
element = document.getElementById("time");
element.innerHTML = thetime;
}
//-->
</script>
</head>
<body onload="start();">
<span id="time"></span>
</body>
</html>
|