JavaScript history属性

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>

<input type="button" value="前进" onclick="func1();">
<input type="button" value="后退" onclick="func2();">
<a href="history_lesson2.html">lesson</a>

<script>
function func1() {
//history.forward();
history.go(2);
}
// history内部三种方法:forward back go 一个属性:length

function func2() {
//history.back();
history.go(-1);
alert(history.length);
}

</script>
</body>
</html>

posted @ 2019-10-30 20:06  一只小白呀  阅读(457)  评论(0编辑  收藏  举报