<!DOCTYPE html> <html> <body> <h1>Window 对象</h1> <h2>setInterval() 和 clearInterval() 方法</h2> <p id="demo1"></p> <p id="demo2" style="color:red;"></p> <script> setInterval(function() {myFunc("param1", "param2")}, 2000); function myFunc(p1, p2) { document.getElementById("demo1").innerHTML += "Hello"; document.getElementById("demo2").innerHTML = "参数:" + p1 + " " + p2; } </script> </body> </html>