返回上一级代码:
<a href="javascript:;" onclick="history.go(-1);" class="icon_back"><i></i></a>
刷新代码:
<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script> <script language=JavaScript> //刷新 parent.location.reload(); </script> <p>3.按F5键<a href="javascript:opener.location.reload()">刷新</a>页面</p>
刷新第二种,试了也可以:
<a href="javascript:void(0)" onclick="window.location.reload()" class="m_header_refresh">刷新</a>
// 刷新后返回顶部 window.onbeforeunload=function(){ $('html,body').scrollTop(0) }
补充:
history历史对象
语法:history.go(-n)
功能:回到历史记录的前n步
语法:history.go(n)
功能:回到历史记录的后n步
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>history历史对象</title> </head> <body> <a href="2.html">2html</a> <a href="3.html">3html</a> <input type="button" value="后退" id="btn"> <input type="button" value="前进" id="btn2"> <script type="text/javascript"> var btn = document.getElementById("btn"), btn2 = document.getElementById("btn2"); btn.onclick=function(){ // history.back(); history.go(-2);//后退 } btn2.onclick=function(){ // history.forward();//前进 history.go(1);//前进 } </script> </body> </html>