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='http://www.phpstudy.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="http://www.phpstudy.net";setTimeout("flash()",1000);} //1000为一秒
<script>setTimeout("location.href=http://www.phpstudy.net",2000)</script>
<script>setTimeout("self.location.reload();",1000);<script>一秒一次
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3