<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input type="text" id="clock" style="width: 300px" />
<input type="button" value="点我,停止计时" onclick="int=window.clearInterval(int)">
</body>
<script language=javascript>
var int=self.setInterval("clock()",50);
function clock()
{
var t=new Date();
document.getElementById("clock").value=t;
}
</script>
</html>
时间: 2024-10-10 23:06:51