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>
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持毛票票!
热门推荐
10 朋友新年祝福语大全 简短
11 新年祝福语简短大方兔年
12 搬新家礼物祝福语简短
13 同学见面花束祝福语简短
14 五一假期祝福语幽默简短
15 离职欢送敬酒祝福语简短
16 对学弟的祝福语简短
17 考老师辞职祝福语简短
18 祝福语驱散霉运的话简短