<html>
<title>计时器</title>
<head>
<meta charset='utf-8'>
<script type="text/javascript">
var c=0
var t
function timedCount()
{
document.getElementById('txt').value=c
c=c+1
t=setTimeout("timedCount()",1000)
}
function stopCount()
{
clearTimeout(t)
}
function resetCount()
{
window.clearInterval(int);
c=0;
document.getElementsByTagName("txt").value='0';
}
</script>
</head>
<body>
<form>
<input type="text" id="txt"value="0"><br>
<input type="button" value="开始计时" onClick="timedCount()">
<input type="button" value="暂停计时!" onClick="stopCount()">
<input type="button" value="刷新计时!" onClick="resetCount()">
</form>
</body>
</html>