jsp倒计时跳转

这里写了 页面的倒计时跳转,例子为10秒跳转
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Refresh" content="10;URL=homepageNew/indexN.html" />

<title>广东省中小企业公共服务平台</title>
<style>
.jumpface{width:600px;margin:0 auto; background:url(face.gif) no-repeat; height:123px;}
.jumpBox{ border-left:1px solid #ffa019; border-bottom:1px solid #ffa019; border-right:1px solid #ffa019; width:600px; height:200px; margin:0 auto; border-top:4px solid #ffa019; text-align:center; padding-top:20px; line-height:36px; font-family:"微软雅黑"; background-color:#f9f9f9;}
.jumpBox span{ font-size:12px; font-size:13.0px; color:#c00;}
.jumpBox span a{ color:#00F; text-decoration:underline;}
</style>
</head>

<body>
<div class="jumpface"></div>
<div class="jumpBox">
正在跳转中......需要<span id="endtime">10</span>秒<br />
<span>如访问新版本网站,请<a href="http://www.968115.cn/omp/homepageNew/indexN.html">点击这里</a>.</span><br />
<span>如访问旧版本网站,请<a href="http://www.968115.cn/omp/homepage/index.html">点击这里</a>.</span><br />

</div><!--单位:秒-->
 <script type="text/javascript">
var CID = "endtime";
if(window.CID != null)
{
    var iTime = document.getElementById(CID).innerText;
    var Account;
    RemainTime();
}
function RemainTime()
{
    var iDay,iHour,iMinute,iSecond;
    var sDay="",sHour="",sMinute="",sSecond="",sTime="";
    if (iTime >= 0)
    {
        iDay = parseInt(iTime/24/3600);
        if (iDay > 0)
        {
            sDay = iDay + "天";
        }
        iHour = parseInt((iTime/3600)%24);
        if (iHour > 0){
            sHour = iHour + "小时";
        }
        iMinute = parseInt((iTime/60)%60);
        if (iMinute > 0){
            sMinute = iMinute + "分钟";
        }
        iSecond = parseInt(iTime%60);
        if (iSecond >= 0){
            sSecond = iSecond + "秒";
        }
        if ((sDay=="")&&(sHour=="")){
            sTime="<span style='color:darkorange'>" + sMinute+sSecond + "</font>";
        }
        else
        {
            sTime=sDay+sHour+sMinute+sSecond;
        }
        if(iTime==0){
            clearTimeout(Account);
              sTime="<span style='color:green'>0</span>";
        }
        else
        {
            Account = setTimeout("RemainTime()",1000);
        }
        iTime=iTime-1;
    }
    else
    {
            sTime="<span style='color:red'>倒计时结束!</span>";
    }
    document.getElementById(CID).innerHTML = sTime;
}
</script>
</body>
</html>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值