Javascript 刷新全集常用代码
更新时间:2009年11月22日 00:20:55 作者:
Javascript刷新页面实现代码,需要的朋友可以参考下。
一:刷新本页面
前台:<script>window.location.href=window.location.href;</script>
后台:Response.Write("<script>window.location.href=window.location.href;</script>")
二:刷新父页面
前台:opener.location.href=opener.location.href;</script>
后台:Response.Write("<script>opener.location.href=opener.location.href;</script>")
三:链接到指定网页
前台:<script>window.location.href='https://www.jb51.net';</script>
MSDN说的window.navigate(sURL)方法是针对IE的,不适用于FF,在HTML DOM Window Object中,根本没有列出window.navigate方法。
后台:Response.Write("<script>window.location.href='yourpage.aspx';</script>")
或者: Response.Write("NewUrl");
四:刷新Iframe
前台:<script>iframe名字或者ID.location.reload(true);</script>
五:定时刷新
function flash(){window.location.href="https://www.jb51.net";setTimeout("flash()",1000);} //1000为一秒
<script>setTimeout("location.href=https://www.jb51.net",2000)</script>
<script>setTimeout("self.location.reload();",1000);<script>一秒一次
前台:<script>window.location.href=window.location.href;</script>
后台:Response.Write("<script>window.location.href=window.location.href;</script>")
二:刷新父页面
前台:opener.location.href=opener.location.href;</script>
后台:Response.Write("<script>opener.location.href=opener.location.href;</script>")
三:链接到指定网页
前台:<script>window.location.href='https://www.jb51.net';</script>
MSDN说的window.navigate(sURL)方法是针对IE的,不适用于FF,在HTML DOM Window Object中,根本没有列出window.navigate方法。
后台:Response.Write("<script>window.location.href='yourpage.aspx';</script>")
或者: Response.Write("NewUrl");
四:刷新Iframe
前台:<script>iframe名字或者ID.location.reload(true);</script>
五:定时刷新
function flash(){window.location.href="https://www.jb51.net";setTimeout("flash()",1000);} //1000为一秒
<script>setTimeout("location.href=https://www.jb51.net",2000)</script>
<script>setTimeout("self.location.reload();",1000);<script>一秒一次
相关文章
在 localStorage 中上传和检索存储图像的示例详解
这篇文章主要介绍了在 localStorage 中上传和检索存储图像,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2022-06-06
es6中class类静态方法,静态属性,实例属性,实例方法的理解与应用分析
这篇文章主要介绍了es6中class类静态方法,静态属性,实例属性,实例方法的理解与应用,结合实例形式分析了es6 class类静态方法,静态属性,实例属性,实例方法相关概念、原理、用法及相关操作注意事项,需要的朋友可以参考下2020-02-02


最新评论