[html]
<html>
<head>
<title>js实现简单的时钟</title>
<script>
function displaytime() {
document.getelementbyid("time").innerhtml = new date().totimestring();
}
setinterval(displaytime,1000); // 每隔1秒钟调用displaytime函数
</script>
</head>
<body>
<p id="time"></p>
</body>
</html>