第二个语句setTimeout(startCount,1000),之后这个语句还会执行吗?
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>计时器</title> <script type="text/javascript"> var num=0; function startCount() { document.getElementById('count').value=num; num=num+1; setTimeout(startCount,1000); } setTimeout(startCount,1000); //触发了startCount()函数,之后还会执行吗? </script> </head> <body> <form> <input type="text" id="count" /> </form> </body> </html>
//Fungsi startCount() dicetuskan, adakah ia masih akan dilaksanakan kemudian? -Soal Jawab tapak web PHP Cina-//Fungsi startCount() dicetuskan, adakah ia masih akan dilaksanakan kemudian? -Soal Jawab laman web PHP Cina
Sila tonton dan pelajari.
单独一条setTimeout只会执行一次