1.History的一些简单使用
代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<input type="button" value="打开2.html" id="bt1" >
<script type="text/javascript">
document.getElementById("bt1").onclick=function(){
location.href="2.html"
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<input type="button" value="back" id="bt1">
<input type="button" value="打开3.html" id="bt2">
<input type="button" value="forward()" id="bt3">
<input type="button" value="go" id="bt4">
<script type="text/javascript">
document.getElementById("bt1").onclick=function(){
history.back();
}
document.getElementById("bt2").onclick=function(){
location.href="3.html"
}
document.getElementById("bt3").onclick=function(){
history.forward()
}
document.getElementById("bt4").onclick=function(){
history.go(-1)
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<input type="button" value="返回2.html" id="bt1">
<input type="button" value="go" id="bt2">
<script type="text/javascript">
document.getElementById("bt1").onclick=function(){
location.href="2.html"
}
document.getElementById("bt2").onclick=function(){
history.go(-1)
}
</script>
</body>
</html>