history内部三种方法:
history.forward() //前进
history.back() //后退
history.go(参数) //-1(后退), 1(前进), 0(当前页面)
一个属性:length //(浏览的页面的个数)
history.length
HTML1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input type="button" value="前进" onclick="func1();">
<a href="histroy_lesson2.html">lesson2</a>
<script>
function func1() {
// history.forward();
history.go(1);
}
</script>
</body>
</html>
HTML2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input type="button" value="后退" onclick="func2();">
<script>
// history内部三种方法:forward back go 一个属性:length
function func2() {
// history.back();
history.go(-1);
alert(history.length)
}
</script>
</body>
</html>