HTML DOM setTimeout() 方法

馋奶兔 提交于 2020-03-18 04:22:32

转自:http://www.w3school.com.cn/jsref/met_win_settimeout.asp

1.setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式。

 

 1 <html>
 2 <head>
 3 <script type="text/javascript">
 4 function timedMsg()
 5 {
 6 var t=setTimeout("alert('5 seconds!')",5000)
 7 }
 8 </script>
 9 </head>
10 
11 <body>
12 <form>
13 <input type="button" value="显示计时的消息框!" onClick = "timedMsg()">
14 </form>
15 <p>点击上面的按钮。5 秒后会显示一个消息框。</p>
16 </body>
17 
18 </html>

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!