sumaolin
9/24/2013 - 7:40 AM

javascript 定时器 倒计时 From http://www.tuicool.com/articles/ZbeQZj

javascript 定时器 倒计时 From http://www.tuicool.com/articles/ZbeQZj

<script type="text/javascript">
var start = 5;
var step = -1;
function count()
{
  document.getElementById("div1").innerHTML = "页面将在"+start+"秒后返回登录页面...";
  start += step;
  if(start <= 0){
    start = 5;
    //window.location="index.jsp";//返回index.jsp页面
    //TODO:在这里可以做相关的操作
  }
setTimeout("count()",1000); 
}
window.onload = count;
</script>