Juney_871128
2018-04-25 18:25
<!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>
不加引号的时候也不需要括号,有两种写法:1)setTimeout("numCount()",1000); 2)setTimeout(numCount,1000);
JavaScript进阶篇
468061 学习 · 21891 问题
相似问题