Javascript <script type="text/javascript"> <!-- function CountDown(OffsetTime,DivName){ if(OffsetTime<=0){ document.getElementById(DivName).innerHTML = "時間到..."; } else{ mySec=(OffsetTime%60); if (mySec<10) mySec="0"+mySec; Other=Math.floor(OffsetTime/60); myMin=(Other%60); if (myMin<10) myMin="0"+myMin; expireTime=myMin+":"+mySec; document.getElementById(DivName).innerHTML =expireTime; OffsetTime--; setTimeout("CountDown('"+OffsetTime+"','"+DivName+"')",1000); } } //--> </script>< <body onload="CountDown('900','TimeDiv')"> <div id="TimeDiv""></div"> </body> </html> -- 2012-03-26 補充 如何停止setTimeout 可用以下的clearTimeout來停止 使用方法如下 meter1=setTimeout("delaySubmit()", 1000 ); clearTimeout(meter1);