@优秀的判断力来自经验,但经验来自于错误的判断。

html 刷新重载方法汇总

Posted on 2017-09-07 16:52  ZMQM  阅读(1397)  评论(0编辑  收藏  举报

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

<a href="javascript:location.reload();">点击重新载入页面</a>
<a href="javascript:history.go(0);">点击重新载入页面</a>
<a href="javascript:location=location;">点击重新载入页面</a>
<a href="javascript:location=location.href;">点击重新载入页面</a>
<a href="javascript:location.replace(location);">点击重新载入页面</a>
<a href="javascript:location.replace(location.href);">点击重新载入页面</a>
<a href="javascript:location.assign(location);">点击重新载入页面</a>
<a href="javascript:location.assign(location.href);">点击重新载入页面</a>
<!--// 以下只支持ie -->
<a href="javascript:document.URL=location.href;">点击重新载入页面</a>
<a href="javascript:navigate(location);">点击重新载入页面</a>
<a href="javascript:document.execCommand('Refresh');">点击重新载入页面</a>
<!--// 以上只支持ie -->

二、html链接重新载入方法

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

三、自动刷新页面的方法

<meta http-equiv="refresh" content="20">  //代码放在head中,每隔20秒钟刷新一次

<meta http-equiv="refresh" content="20;url=http://www.haorooms.com">  //20秒之后页面跳转到haorooms中,通常运用到404页面

//js自动刷新
function myrefresh()

{

       window.location.reload();

}

setTimeout('myrefresh()',1000); //指定1秒刷新一次

 四、返回上一页或下一页

<meta http-equiv="refresh" content="20">  //代码放在head中,每隔20秒钟刷新一次

<meta http-equiv="refresh" content="20;url=http://www.haorooms.com">  //20秒之后页面跳转到haorooms中,通常运用到404页面

//js自动刷新
function myrefresh()

{

       window.location.reload();

}

setTimeout('myrefresh()',1000); //指定1秒刷新一次

关注微信小程序  

@用代码行数来测评软件开发进度,就相对于用重量来计算飞机建造进度。