<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>计时器</title>
<script type="text/javascript">
var num=0;
function startCount() {
document.getElementById('count').value=num;
num=num+1;
setTimeout("startCount()",5000);
}
</script>
</head>
<body >
<form>
<input type="text" id="count" />
</form>
</body>
</html>
再用一个按钮调用这个函数就好了
<input type="button" value="start" onclick="startCount()"/>
或者函数结束之后,设置一个setTimeout(startcount,1000);也可以