<input type="text" id="displayBox" name="displayBox" value="0"> <script> x = 0 function countSecond() { x = x+1 document.getElementById("displayBox").value=x setTimeout("countSecond()", 1000) } // 执行函数 countSecond() </script>