错误提示页面自动返回上一页

<body>
    <table align="center" width="400" cellpadding="10" border="0" style="text-align:center; margin:0 auto; margin-top:100px; border:#FF6600 1px solid; font-family : Arial;font-size : 11px;color : #656565;" >
    <tr>
        <td width="50" rowspan="3" valign="top" >
            <a href="javascript:history.go(-1)"><span id="spanSeconds">10</span>seconds</a>
        </td>
    </tr>
    <tr>
        <td id="redirectionMsg" align="left">
         error message
        </td>
    </tr>
    </table>
    <script language="JavaScript">
    //等待多长时间跳转
    var seconds = 10;
    //这就是自动跳转的页面地址  默认我写成javascript:history.go(-1)  也可以写别的地址如2.html
    var defaultUrl = "javascript:history.go(-1)";
    onload = function()
    {

      if (defaultUrl == 'javascript:history.go(-1)' && window.history.length == 0)
      {
        document.getElementById('redirectionMsg').innerHTML = '';
        return;
      }

      window.setInterval(redirection, 1000);
    }
    function redirection()
    {
      if (seconds <= 0)
      {
        window.clearInterval();
        return;
      }

      seconds --;
      document.getElementById('spanSeconds').innerHTML = seconds;

      if (seconds == 0)
      {
        window.clearInterval();
        location.href = defaultUrl;
      }
    }
</script>
</body>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值