一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

HTML meta refresh 刷新与跳转(重定向)页面

时间:2014-08-27 编辑:简简单单 来源:一聚教程网

refresh 属性值  --  刷新与跳转(重定向)页面

refresh用于刷新与跳转(重定向)页面

refresh出现在http-equiv属性中,使用content属性表示刷新或跳转的开始时间与跳转的网址


refresh示例

5秒之后刷新本页面:

5秒之后转到梦之都首页:

当然除了这些方法还有js也可以跳转与刷新了,下面既然讲到这个刷新页面了我们就再看看js补充吧

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

js页面跳转

1.window.location.href方式
   

2.window.navigate方式跳转
  

 

3.window.loction.replace方式实现页面跳转,注意跟第一种方式的区别

有3个jsp页面(1.aspx, 2.aspx, 3.aspx),进系统默认的是1.aspx,当我进入2.aspx的时候, 2.aspx里面用window.location.replace("3.aspx");

与用window.location.href ("3.aspx");

从用户界面来看是没有什么区别的,但是当3.aspx页面有一个"返回"按钮,调用window.history.go(-1); wondow.history.back();方法的时候,一点这个返回按钮就要返回2.aspx页面的话,区别就出来了,当用 window.location.replace("3.aspx");连到3.aspx页面的话,3.aspx页面中的调用 window.history.go(-1);wondow.history.back();方法是不好用的,会返回到1.aspx。

4.self.location方式实现页面跳转,和下面的top.location有小小区别
  

5.top.location
  

 

6.不推荐这种方式跳转
   

 meta方式实现跳转(content = 3 单位是秒)

热门栏目