這段代碼起到什么作用?
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
? var num=0,i;
? function timedCount(){
? ? document.getElementById('txt').value=num;
? ? num=num+1;
? ? i=setTimeout(timedCount,1000);
? }
? ? setTimeout(timedCount,1000);
? function stopCount(){
? ? clearTimeout(i);
? }
</script>
</head>
<body>
? <form>
? ? <input type="text" id="txt">
? ? <input type="button" value="Stop" onClick="stopCount()">
? </form>
</body>
</html>
請(qǐng)問粗體的代碼起到什么作用?
2016-09-29
一秒鐘后執(zhí)行函數(shù)timeCount(),當(dāng)然函數(shù)內(nèi)部調(diào)用自身主要是達(dá)到無限循環(huán)的目的
2016-09-29
一秒鐘后執(zhí)行函數(shù)timeCount()