运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The Window Object</h1> <h2>The setTimeout() Method</h2> <p>The input field will tell you when two, four, and six seconds have passed.</p> <input type="text" id="txt"> <script> let x = document.getElementById("txt"); setTimeout(function(){ x.value="2 seconds" }, 2000); setTimeout(function(){ x.value="4 seconds" }, 4000); setTimeout(function(){ x.value="6 seconds" }, 6000); </script> </body> </html>