Created
July 3, 2013 06:23
-
-
Save markyun/5915830 to your computer and use it in GitHub Desktop.
<!--js实现定义倒计时后自动跳转页面-->
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"> | |
// <span style="color: red;" id="totalSecond">5</span>秒 | |
var second = document.getElementById('totalSecond').textContent; | |
if (navigator.appName.indexOf("Explorer") > -1) | |
{ | |
second = document.getElementById('totalSecond').innerText; | |
} else | |
{ | |
second = document.getElementById('totalSecond').textContent; | |
} | |
setInterval("redirect()", 1000); | |
function redirect() | |
{ | |
if (second < 0) | |
{ | |
// <!--定义倒计时后跳转页面--> | |
location.href = 'http://localhost:8080/'; | |
} else | |
{ | |
if (navigator.appName.indexOf("Explorer") > -1) | |
{ | |
document.getElementById('totalSecond').innerText = second--; | |
} else | |
{ | |
document.getElementById('totalSecond').textContent = second--; | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment