js刷新页面和跳转

javascript返回上一页:

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

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

二、history.back().ui

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

四、window.history.go(返回第几页,也能够是url)spa

五、window.location.href=url;code

js刷新页面的几种方法:

一、history.go(0);blog

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

三、location=location;it

四、location.replace(location);io

五、location.assign(location);

六、window.navigate(location);

七、document.URL=location.href

自动刷新页面的方法:

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

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

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

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

三、页面自动刷新,js

复制代码
<script language="JavaScript">
    function myrefresh()
    {
           window.location.reload();
    }
    setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
相关文章
相关标签/搜索