zoukankan      html  css  js  c++  java
  • html-javascript前端页面刷新重载的方法汇总

    一、javascript页面刷新重载的方法:

     1 <a href="javascript:location.reload();">点击重新载入页面</a>
     2 <a href="javascript:history.go(0);">点击重新载入页面</a>
     3 <a href="javascript:location=location;">点击重新载入页面</a>
     4 <a href="javascript:location=location.href;">点击重新载入页面</a>
     5 <a href="javascript:location.replace(location);">点击重新载入页面</a>
     6 <a href="javascript:location.replace(location.href);">点击重新载入页面</a>
     7 <a href="javascript:location.assign(location);">点击重新载入页面</a>
     8 <a href="javascript:location.assign(location.href);">点击重新载入页面</a>
     9 <!--// 以下只支持ie -->
    10 <a href="javascript:document.URL=location.href;">点击重新载入页面</a>
    11 <a href="javascript:navigate(location);">点击重新载入页面</a>
    12 <a href="javascript:document.execCommand('Refresh');">点击重新载入页面</a>
    13 <!--// 以上只支持ie -->

    二、html链接重新载入方法

    1 <!--// 以下不支持ie -->
    2 <a href="">点击重新载入页面</a>
    3 <!--// 以上不支持ie -->
    4 <a href="页面本身">点击重新载入页面</a>

    三、自动刷新页面的方法

     1 <meta http-equiv="refresh" content="20">  //代码放在head中,每隔20秒钟刷新一次
     2 
     3 <meta http-equiv="refresh" content="20;url=http://www.haorooms.com">  //20秒之后页面跳转到haorooms中,通常运用到404页面
     4 
     5 //js自动刷新
     6 function myrefresh()
     7 
     8 {
     9 
    10        window.location.reload();
    11 
    12 }
    13 
    14 setTimeout('myrefresh()',1000); //指定1秒刷新一次

    三、返回上一页和下一页的方法

    1 history.go(-1)//返回上一页(括号中写-2代表返回上两页)
    2 
    3 history.back()//返回上一页
    4 
    5 window.history.forward()  //返回下一页

    by  小鬼PSer  2017-09-30  09:51:35 

  • 相关阅读:
    苹果p12文件--一个苹果证书怎么多次使用(蛋疼,这些问题只有和其他企业合作才会遇到,别人的账号不可能给你,蛋疼....)
    xcode 树形管理 cocos2d-x的资源
    cocos2d-x 扩充引擎基类功能 引起的头文件重复包含问题的分析
    pytest--运行指定的测试和参数化
    adb--常用命令
    appium--desktop
    adb--环境安装
    pytest--命令行常用参数
    django -- auth模块
    pytest--常用插件
  • 原文地址:https://www.cnblogs.com/php-qiuwei/p/7613771.html
Copyright © 2011-2022 走看看