问答详情
源自:8-5 计时器setTimeout()

哪里调用自身函数了?

<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
var num=0;
function numCount(){
document.getElementById('txt').value=num;
num=num+1;
setTimeout("numCount()",1000);
}
</script>
</head>
<body>
<form>
<input type="text" id="txt" />
<input type="button" value="Start" onClick="numCount()" />
</form>
</body>
</html>

提问者:慕粉4296528 2017-02-25 22:09

个回答

  • 慕盖茨4383490
    2017-02-25 22:39:35
    已采纳

    函数numCount()在“setTimeout("numCount()",1000);”这行代码中调用了自身