首页 > Web开发 > 详细

js刷新页面和跳转

时间:2019-11-14 12:44:13      阅读:76      评论:0      收藏:0      [点我收藏+]

javascript返回上一页:

1、返回上一页 history.go(-1); 返回上两个页面 history.go(-2);

<a href="javascript:history.go(-1);">上一页</a>

2、history.back().

3、window.history.forward() 返回下一页

4、window.history.go(返回第几页,也可以是url)

5、window.location.href=url;

js刷新页面的几种方法:

1、history.go(0);

2、window.location.href=当前页面url;

3、location=location;

4、location.replace(location);

5、location.assign(location);

6、window.navigate(location);

7、document.URL=location.href

自动刷新页面的方法:

1、页面自动刷新:在<head>标签中加入

<meta http=-equiv="refresh" content="20">其中20指每隔20s刷新一次

2、页面自动跳转:在<head>标签中加入

<meta http=-equiv="refresh" content="20;url="http:www.baidu.com">其中20指20s后跳转到http://www.baidu.com

3、页面自动刷新,js

技术分享图片
<script language="JavaScript">
    function myrefresh()
    {
           window.location.reload();
    }
    setTimeout(‘myrefresh()‘,1000); //指定1秒刷新一次
</script>

js刷新页面和跳转

原文:https://www.cnblogs.com/hcm-php/p/11855786.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!