W3School TIY
编辑您的代码:
<html> <head> <script type="text/javascript"> function timedMsg() { var t=setTimeout("alert('5 seconds!')",5000) } </script> </head> <body> <form> <input type="button" value="显示计时的消息框!" onClick = "timedMsg()"> </form> <p>点击上面的按钮。5 秒后会显示一个消息框。</p> </body> </html>
查看结果: