<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>一个标题</h1>
<input type="button" value="一个按钮" id="btn">
<a href="2.html" >跳转到二级页面</a>
<br>
<input type="button" value="点击前进forward" id="qqq">
<input type="button" value="点击后退back" id="ttt">
<br>
<input type="button" value="点击前进go1" id="qqq1">
<input type="button" value="点击后退go-1" id="ttt1">
<script>
var btn = document.getElementById("btn");
var qqq = document.getElementById("qqq");
var ttt = document.getElementById("ttt");
var qqq1 = document.getElementById("qqq1");
var ttt1 = document.getElementById("ttt1");
qqq.onclick = function(){
history.forward();
};
ttt.onclick = function(){
history.back();
};
qqq1.onclick = function(){
history.go(1);
};
ttt1.onclick = function(){
history.go(-1);
};
</script>
</body>
</html>