Loading

HTML 自动刷新页面

  直接上代码,易懂。实际运用自行变动啦。

  Meta 标签版:

<!DOCTYPE html>
<html>
    <head>
        <meta content="Author" name="notfound945">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <meta http-equiv="refresh" content="2"> <!--指定 2 秒刷新-->
        <title>Auto refresh</title>
        <script type="text/javascript">
            var myDate = new Date();//以静态的时间为参照
            document.write(myDate.toLocaleString())
        </script>
    </head>
        <body>
        </body>
</html>

 

<!DOCTYPE html>
<html>
    <head>
        <meta content="Author" name="notfound945">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <meta http-equiv="refresh" content="10;http://www.cnblogs.com/notfound/"> <!--指定 10 秒刷新跳转到指定地址-->
        <title>Auto refresh</title>
    </head>
        <body>
        <h1 style="text-align:center">10 S后自动跳转到 notfound945 的博客地址</h1>
        </body>
</html>

 

  JS版: (与Meta混用时,Meta版失效)

<!DOCTYPE html>
<html>
    <head>
        <meta content="Author" name="notfound945">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <title>Auto Refresh</title>
        <script language="JavaScript">
            setTimeout(function(){location.reload()},1000); //指定1秒刷新一次
        </script>
        <script type="text/javascript">
            var myDate = new Date();
            document.write(myDate.toLocaleString())
        </script>
    </head>
        <body>
        </body>
</html>

 

posted @ 2018-02-14 19:54  notfound945  阅读(179)  评论(0)    收藏  举报