javascript refresh page 几种页面刷新的方法

Javascript刷新页面的几种方法:
1    history.go(0) 
2    location.reload() 
3    location=location 
4    location.assign(location) 
5    document.execCommand(‘Refresh‘) 
6    window.navigate(location) 
7    location.replace(location) 
8    document.URL=location.href

自动刷新页面的方法:
1.页面自动刷新:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20">
其中20指每隔20秒刷新一次页面.

2.页面自动跳转:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20;url=http://www.wyxg.com">
其中20指隔20秒后跳转到http://www.wyxg.com/页面

3.页面自动刷新js版
<script language="JavaScript">
function myrefresh()
{
       window.location.reload();
}
setTimeout(‘myrefresh()‘,1000); //指定1秒刷新一次
</script>

ASP.NET如何输出刷新父窗口脚本语句
1.   this.response.write("<script>opener.location.reload();</script>");

2.   this.response.write("<script>opener.window.location.href = opener.window.location.href;</script>");

3.   Response.Write("<script language=javascript>opener.window.navigate(‘‘你要刷新的页.asp‘‘);</script>")

JS刷新框架的脚本语句

//如何刷新包含该框架的页面用   
<script language=JavaScript>
   parent.location.reload();
</script>

//子窗口刷新父窗口
<script language=JavaScript>
    self.opener.location.reload();
</script>
( 或 <a href="javascript:opener.location.reload()">刷新</a>   )
//如何刷新另一个框架的页面用   
<script language=JavaScript>
   parent.otherFrameID.location.reload();
</script>

如果想关闭窗口时刷新或者想开窗时刷新的话,在<body>中调用以下语句即可。
<body > 开窗时刷新
<body onUnload="opener.location.reload()"> 关闭时刷新
<script language="javascript">
window.opener.document.location.reload()
</script>

javascript refresh page 几种页面刷新的方法

时间: 2024-08-30 00:45:42

javascript refresh page 几种页面刷新的方法的相关文章

js页面刷新的方法location.reload()

reload 方法,该方法强迫浏览器刷新当前页面.语法:location.reload([bForceGet])参数: bForceGet, 可选参数, 默认为 false,从客户端缓存里取当前页.true, 则以 GET 方式,从服务端取最新的页面, 相当于客户端点击 F5("刷新") 96 @switch_state = (entity_class, entity_id, state_attribute_name) -> 97 $.ajax({ 98 url: '<%=

点击浏览器的返回按钮或者手机上的返回按钮页面刷新解决方法

在页面中的js代码中加上下面这句话即可.window.onload = function(){ var url = window.location.href; var ps = url.split("#"); try{ if(ps[1] != 1){ url += "#1"; }else{ window.location = ps[0]; } }catch(ex){ url += "#1"; } window.location.replace(u

javascript页面刷新的几种方法

javascript refresh page 几种页面刷新的方法 本节内容:Javascript刷新当前页面的方法与实例. window.location.reload(),window.history.go(0)和document.execCommand(''Refresh''),这三个方法是最快速的.其他的都有明显的浏览器滚动条的出现. Javascript刷新页面的几种方法: 1 history.go(0)除非有<%..%>等需在服务端解释才能生成的页面代码,否则直接读取缓存中的数据不

meta http-equiv=&quot;refresh&quot; 和13种跳转页面方法

· meta http-equiv="refresh" 和13种跳转页面方法 我们来说说13种页面跳转方法 先来介绍一下在服务端JSP脚本中跳转页面的4种方法: 一.在服务端JSP脚本中跳转 1. response.sendRedirct(“跳转到页面”); 该方法通过修改HTTP协议的HEADER部分,对浏览器下达重定向指令的,使浏览器显示重定向网页的内容. request无法传值过去. 执行完该页所有代码,然后再跳转到页面. 跳转地址栏改变. 可以跳转到其他服务器上的页面respo

html-javascript前端页面刷新重载的方法汇总

记得我在兴安得力实习要转正的时候,我领导象征性的给我出了一套测试题目,里面就有js闭包和页面刷新等题目.今天把很久之前的测试题目之一,js页面刷新的方法以及页面自动刷新跳转和返回上一页和下一页等方法总结一下,仅供大家参考! 一.javascript页面刷新重载的方法: <a href="javascript:location.reload();">点击重新载入页面</a> <a href="javascript:history.go(0);&qu

php开发中的页面跳转方法总结

PHP页面跳转实现的功能就是将网站中一个网页跳转到另一个网页中.对于刚刚学习PHP语言的朋友来说,是必须要掌握的基础方法. 页面跳转可能是由于用户单击链接.按钮等触发的,也可能是系统自动产生的.页面自动跳转在WEB开发中经常用到,而且根据需求可以采用不同的跳转方式,比如提示操作信息后延时跳转等, 本文总结了WEB开发中常见的几种页面跳转方法. PHP header()函数跳转 PHP的header()函数非常强大,其中在页面url跳转方面也调用简单,使用header()直接跳转到指定url页面,

Javascript 页面刷新

Javascript 页面刷新的实现代码收藏 1 2 3 4 5 6 7 8 history.go(0) location.reload() location=location location.assign(location) document.execCommand('Refresh') window.navigate(location) location.replace(location) document.URL=location.href

javascript刷新父页面的各种方法汇总

转自https://www.cnblogs.com/yysbolg/p/9183626.html 1.用iframe.弹出子页面刷新父页面iframe <script language=JavaScript> parent.location.reload(); </script> 2.弹出子页面 <script language=JavaScript> window.opener.location.reload(); </script> 3.子窗口刷新父窗口

JavaScript页面刷新与弹出窗口问题的解决方法

1. [代码][JavaScript]代码     ?一.无提示刷新网页 大家有没有发现,有些网页,刷新的时候,会弹出一个提示窗口,点“确定”才会刷新.而有的页面不会提示,不弹出提示窗口,直接就刷新了. 如果页面没有form,则不会弹出提示窗口. 如果页面有form表单,  a)< form method="post" ...> 会弹出提示窗口  b)< form method="get" ...> 不会弹出 二.javascript刷新页面