就像吃了炫邁,根本停不下來。。。。
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>計(jì)時(shí)器</title>
<script type="text/javascript">
? var num=0;
? var i;
? function startCount(){
? ? document.getElementById('count').value=num;
? ? num=num+1;
? ? i=setTimeout("startCount()",1000);
? }
? function stopCount(){
? clearTimeout(i);
? }
</script>
</head>
<body>
? <form>
? ? <input type="text" id="count" />
? ? <input type="button" value="Start" onclick="startCount()"? />
? ? <input type="button" value="Stop" omclick="stopCount()"? ?/>
? </form>
</body>
</html>
2018-09-05
<input type="button" value="Stop" omclick="stopCount()"? ?/>
是onclick,不是om ??
2018-10-30
你一直點(diǎn)擊Start按鈕,會(huì)發(fā)現(xiàn)越來越快的。。。