<!DOCTYPE html>
<html>
<head>
	<title>实时动态时间显示</title>
	<script>
		function updateTime() {
			var now = new Date();
			var hours = now.getHours();
			var minutes = now.getMinutes();
			var seconds = now.getSeconds();
			var timeString = hours + ":" + minutes + ":" + seconds;
			document.getElementById('time').innerHTML = timeString;
		}
<pre><code>	window.onload = function() {
		updateTime();
		setInterval(updateTime, 1000);
	};
&lt;/script&gt;
</code></pre>
</head>
<body>
	<div id='time'></div>
</body>
</html>