history对象 保存了用户在浏览器中访问页面的历史记录语法:history.back()功能:回到历史记录的上一步相当于是用了history.go(-1)//-1表示前一步,-2前两部语法:history.go(1)功能:回到历史记录的前一步相当于history.forward()语法:history.go(-n)功能:回到历史记录的前n部语法:history.go(n)功能:回到历史记录的后n步
4-1html文件
<p>06</p><a href="07-history对象.html">07.html</a></body>
4-2 history对象.html文件
<p>07</p><button id="btn">btn</button><script>var btn = document.getElementById("btn")btn.onclick = function(){history.back(); // 回到历史记录的上一步}</script>
