简单的计时

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function timedMsg()
  5. {
  6. var t=setTimeout("alert('5 秒!')",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>