晕了,一半天才发现自己代码写错了,写成了setTimeout=("startCount()",1000);
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>݆测试</title> </head> <body> <form> <input type="text" id="count" /> <script type="text/javascript"> var num=0; function startCount(){ document.getElementById('count').value=num; num=num+1; setTimeout("startCount()",1000); } setTimeout("startCount()",1000); </script> </form> </body> </html>