- <html>
- <body>
- <input type="text" id="clock" size="35" />
- <script language=javascript>
- var int=self.setInterval("clock()",50)
- function clock()
- {
- var t=new Date()
- document.getElementById("clock").value=t
- }
- </script>
- </form>
- <button onclick="int=window.clearInterval(int)">
- Stop interval</button>
- </body>
- </html>
- <html>
- <head>
- <script type="text/javascript">
- function timedMsg()
- {
- var t=setTimeout("alert('5 seconds!')",5000)
- }
- </script>
- </head>
- <body>
- <form>
- <input type="button" value="Display timed alertbox!" onclick="timedMsg()">
- </form>
- <p>Click on the button above. An alert box will be
- displayed after 5 seconds.</p>
- </body>
- </html>
- <html>
- <head>
- <script type="text/javascript">
- var c=0
- var t
- function timedCount()
- {
- document.getElementById('txt').value=c
- cc=c+1
- t=setTimeout("timedCount()",1000)
- }
- function stopCount()
- {
- clearTimeout(t)
- }
- </script>
- </head>
- <body>
- <form>
- <input type="button" value="Start count!" onclick="timedCount()">
- <input type="text" id="txt">
- <input type="button" value="Stop count!" onclick="stopCount()">
- </form>
- </body>
- </html>
新闻热点
疑难解答
图片精选