源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教程</title> </head> <body> <p>單擊按鈕每3秒出現一個“Hello”警告框。</p> <p>再次點擊警告框,經過3秒出現新的警告框,這將一直執行 ...</p> <button onclick="myFunction()">點我</button> <script> function myFunction(){ setInterval(function(){alert("Hello")},3000); } </script> </body> </html>
運行結果