<!DOCTYPE HTML>
<html>
<head>
<script>
function kaishi(){
var abb= new Date();
document.getElementById("con").value=abb;
var i=setInterval(kaishi,1000);
}
</script>
</head>
<body>
<input type ="text" id="con" size="60"/>
<input type="button" value="jieshu" onclick="clearInterval(i)" />
<input type ="button" value="start" onclick="kaishi()" />
</body>
</html>
<html>
<body>
<input type="text" id="clock" size="35" />
<script language=javascript>
var int=self.setInterval("clock()",50)
function clock()
{
var t=new Date()
document.getElementById("clock").value=t
}
</script>
<button onclick="int=window.clearInterval(int)">Stop interval</button>
<button onclick="int=window.setInterval('clock()',50)">Start interval</button>
</body>
</html>
http://www.w3school.com.cn/jsref/met_win_setinterval.asp
你试试 这样就可以了
<!DOCTYPE HTML>
<html>
<head>
<script>
function kaishi(){
var abb= new Date();
document.getElementById("con").value=abb;
}
var i=setInterval('kaishi()',1000);
function end(){
clearInterval(i);
}
function start(){
i=setInterval('kaishi()',1000);
}
</script>
</head>
<body onload = 'kaishi();'>
<input type ="text" id="con" size="60"/>
<input type="button" value="jieshu" onclick="end()" />
<input type ="button" value="start" onclick="start()" />
</body>
</html>