日期:2014-05-16  浏览次数:20327 次

js动态进行倒计时计数

js动态进行倒计时计数:

?

<div id="num"></div>
<SCRIPT language="javascript">
 secs = 60; // 设置多少秒
 wait = secs * 100;
  document.getElementById("num").disabled =true;
 for(i=1;i<=(wait/100);i++) {
  window.setTimeout("doUpdate(" + i + ")", i * 100);
 }
 window.setTimeout("Timer()", wait);

 function doUpdate(num) {
  if(num == (wait/100)) {
   document.getElementById("num").innerHTML = "  ";
  } else {
   wut = (wait/100)-num;
      document.getElementById("num").innerHTML  = secs+"秒倒计时: " + wut + "";
  }
 }

 function Timer() {
    document.getElementById("num").disabled =false;
}
</SCRIPT>
 

?