另一个简单的计时
- <html>
- <head>
- <script type="text/javascript">
- function timedText()
- {
- var t1=setTimeout("document.getElementById('txt').value='2 seconds!'",2000)
- var t2=setTimeout("document.getElementById('txt').value='4 seconds!'",4000)
- var t3=setTimeout("document.getElementById('txt').value='6 seconds!'",6000)
- }
- </script>
- </head>
- <body>
- <form>
- <input type="button" value="显示计时的文本!" onClick="timedText()">
- <input type="text" id="txt">
- </form>
- <p>在按钮上面点击。输入框会显示出已经流逝的 2、4、6 秒钟。</p>
- </body>
- </html>