Created
September 24, 2013 07:40
-
-
Save sumaolin/6681540 to your computer and use it in GitHub Desktop.
javascript 定时器 倒计时
From http://www.tuicool.com/articles/ZbeQZj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment