boonyaxnn 2009-12-07
代码如下:
<div id="liujincai"></div> <input type="button" name="start" value="start" onclick='startShow();'> <input type="button" name="stop" value="stop" onclick="stop();"> <script language="javascript"> var intvalue=1; var timer2=null; function startShow() { liujincai.innerHTML=liujincai.innerHTML + " " + (intvalue ++).toString(); timer2=window.setTimeout("startShow()",2000); } function stop() { window.clearTimeout(timer2); } </script>
代码如下:
<div id="liujincai"></div> <input type="button" name="start" value="start" onclick='timer2=window.setInterval("startShow()",2000);//startShow();'> <input type="button" name="stop" value="stop" onclick="stop();"> <script language="javascript"> var intvalue=1; var timer2=null; function startShow() { liujincai.innerHTML=liujincai.innerHTML + " " + (intvalue ++).toString(); } function stop() { window.clearInterval(timer2); } </script>