简单的计时

  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>