zoukankan      html  css  js  c++  java
  • Web中的页面刷新

    由于本人比较讨厌Web、因此这方面关注的比较少也基本上不知道什么,今天整理资料看到本本上还有这么一篇总结,又不忍心将它扔掉,所以也就抛上来了,就当是分享吧。

    1.实现页面自动刷新

     

    把如下代码加入到<head>区域

    <meta http-equiv="refresh" content="5">

     

    2.页面自动跳

    <meta http-equiv="refresh" content ="5;url=http://www.baidu.com">

    指定隔5秒后跳转到指定的页面httt://www.baidu.com,如果是当前页面,则为自动刷新。

     

    3.setTimeout()方法实现。

    <body onload="setTimeout('history.go(0),5000')">

    <body onload="setTimeout('this.location.reload();',5000)">

     

    可以通过脚本实现:

    <script language="javascript">

    function chang()

    {

    document.location='http://ww.baidu.com';

    }

    setTimeout(chang,50000);    //定时执行

    //setInterval(chang,5000);    //间隔执行

    //setTimeout("document.location='http://www.baidu.com'",3000)

    </script>

     

    4.按钮刷新得N种方法

    <input type=button value="刷新" onclick="history.to(0)">

    <input type=button value="刷新" onclick="location.reload()">

    <input type=button value="刷新" onclick="location=location">

    <input type=button value="刷新" onclick="document.execCommand('Refresh')">

    <input type=button value="刷新" onclick="window.navigate(location)">

    <input type=button value="刷新" onclick="location.replace(location)">

    <intpu type=button value="刷新" onclick="window.open('http://www.baidu.com'),'_self')">

    <input type=button value="刷新" onclick="window.all.WebBrowser.ExecWb(22,1)">

      



    返回导读目录,阅读更多随笔



    分割线,以下为博客签名:

    软件臭虫情未了
    • 编码一分钟
    • 测试十年功


    随笔如有错误或不恰当之处、为希望不误导他人,望大侠们给予批评指正。

  • 相关阅读:
    三线程连续打印ABC
    Mybatis知识点总结
    【刷题】LeetCode 292 Nim Game
    Java界面编程-建立一个可以画出图形的简单框架
    第11章 持有对象
    第10章 内部类
    构造器和多态(Chapter8.3)
    对象的创建过程(chapter5.7.3)
    静态数据的初始化(Chapter5.7.2)
    final关键字
  • 原文地址:https://www.cnblogs.com/08shiyan/p/1864900.html
Copyright © 2011-2022 走看看