<font size="4"><b>Javascript Displaying self updating time on a webpage Tutorial
PHP Code:
<html>
<body>
<div id="date">
</div>
<script language="JavaScript">
//Create a function to call later.
function update() {
//This variable equals the computers date.
time = Date();
//Change the inside html "date" to the variable time.
document.getElementById('date').innerHTML = time;
//update this function in 0 time.
setTimeout("update()", 0);
}
//call our function to start.
update();
</script>
</body>
</html>
Easy eh? Here it is without comments so you can copy & paste without need to edit:
<html>
<body>
<div id="date">
</div>
<script language="JavaScript">
function update() {
time = Date();
document.getElementById('date').innerHTML = time;
setTimeout("update()", 0);
}
update();
</script>
</body>
</html>
C Ya