JavaScript实现倒计时跳转页面功能【实用】
这里给大家提供一个好用的JS写的倒计时页面,就像一些网站上点提交后出现的倒计时页面类似。
页面代码简单,直接拷贝就能运行,页面可以自己美化下。
<!--这里定义倒计时开始数值-->
<spanid="totalSecond">5</span>
<!--定义js变量及方法-->
<scriptlanguage="javascript"type="text/javascript">
varsecond=document.getElementById('totalSecond').textContent;
if(navigator.appName.indexOf("Explorer")>-1)
{
second=document.getElementById('totalSecond').innerText;
}else
{
second=document.getElementById('totalSecond').textContent;
}
setInterval("redirect()",1000);
functionredirect()
{
if(second<0)
{
<!--定义倒计时后跳转页面-->
location.href='default.aspx';
}else
{
if(navigator.appName.indexOf("Explorer")>-1)
{
document.getElementById('totalSecond').innerText=second--;
}else
{
document.getElementById('totalSecond').textContent=second--;
}
}
}
</script>
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持毛票票!
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短