setTimeout()最后一个代码有问题啊??函数不能自己调用自己。我自己开了HTML网页,想把num的值数出来,发现会出现错误提醒,说numCount函数无定义
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
var num=0;
function numCount(){
document.getElementById('txt').value=num;
document.write(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>