前端页面刷新与跳转

a标签里面的刷新方式
1、<a href="javascript:" onclick="history.go(-2); ">返回前两页</a>
2、<a href="javascript:" onclick="self.location=document.referrer;">返回上一页并刷新</a>
3、<a href="javascript:" onclick="history.back(); ">返回上一页</a>
4、<a href="javascript:history.go(-1)">返回上一页</a>
5、<a href="javascript:location.reload()">重载页面,本地刷新</a>
6、<a href="javascript:history.go(-1);location.reload()">返回上一页重载页面,本地刷新</a>
7、<a href="javascript:window.stop()">停止跳转</a>(停止跳转:IE浏览器用document.execCommand("Stop"),Chrome和Firefox用window.stop()  ) 
局部刷新
(“#table_table”是需要刷新的框架id):$("#refresh_box").load(location.href+" #refresh_content");
注意一点是,例子中,是用 #refresh_box 来"包裹"着 #refresh_content 的,所以 $("#refresh_box").load("http://localhost:8090/admin/user/list #refresh_content"); 的作用是先通过ajax去请求 http://localhost:8090/admin/user/list #refresh_content 获得里面的 HTML 内容,然后装到 本页面的 #refresh_box中。
全页面的刷新方法
window.location.reload()刷新当前页面.
parent.location.reload()刷新父亲对象(用于框架)
opener.location.reload()刷新父窗口对象(用于单开窗口)
top.location.reload()刷新最顶端对象(用于多开窗口)

猜你喜欢

转载自www.cnblogs.com/yangyang63963/p/11533072.html