js制作404错误页面5秒钟倒计时自动跳转

    xiaoxiao2021-03-25  121

    <!doctype html> <html lang="zh-cn"> <head> <meta charset="utf-8"> <title>404错误页面</title> </head> <body> <div style="width:500px; height:350px; position:absolute; top:50%; left:50%; font-family:'Arial'; text-align:center; margin-left:-225px; margin-top:-175px;"> <h1 style="font-size:200px; line-height:0; color:#444;;">404</h1> <p style="color:#ccc; font-size:18px;">Sorry,this page flew to the moon!</p> <p><strong id="time" style="color:#D3070A;">5</strong>秒后自动跳转,如果不跳转,请点击下面的链接<a href="http://www.baidu.com/">返回首页</a></p> </div> <script type="text/javascript"> function delayURL(url) { var delay = document.getElementById("time").innerHTML; if(delay > 0) { delay--; document.getElementById("time").innerHTML = delay; } else { window.top.location.href = url; } setTimeout("delayURL('" + url + "')", 1000); } delayURL("http://www.baidu.com/"); </script> </body> </html>
    转载请注明原文地址: https://ju.6miu.com/read-9404.html

    最新回复(0)