运行 ❯
获取您
的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The Window Object</h1> <h2>The setInterval() Method</h2> <p>In this example, we display the parameters passed to mytFunc() (does not work in IE9 and earlier).</p> <p id="demo1"></p> <p id="demo2" style="color:red"></p> <script> setInterval(myFunc, 2000, "param1", "param2"); function myFunc(p1, p2) { document.getElementById("demo1").innerHTML += "Hello"; document.getElementById("demo2").innerHTML = "Parameters passed: " + p1 + " " + p2; } </script> </body> </html>