a页面:
<title>history对象</title>
</head>
<script type="text/javascript">
<!--
/*
history对象存储了访问过的页面。
*/
function fun(){
history.forward();
}
//-->
</script>
<body>
aaaaaaaaaaaaaaaaaaaaaaaaaaa
<a href = "b.html">b.html</a>
<input type="button" value="前进" οnclick="fun()">
</body>
</html>
b页面:
</head>
<script type="text/javascript">
<!--
/*
history对象存储了访问过的页面。
*/
function fun(){
history.forward();
}
function fun1(){
history.back() ;
}
function fun2(){
history.go(2) ;
}
//-->
</script>
<body>
bbbbbbbbbbbbbbbbbb
<a href = "c.html">c.html</a>
<input type="button" value="前进" οnclick="fun()">
<input type="button" value="后退" οnclick="fun1()">
<input type="button" value="直接去d页面" οnclick="fun2()">
</body>
</html>
c页面:
<script type="text/javascript">
<!--
/*
history对象存储了访问过的页面。
*/
function fun(){
history.forward();
}
function fun1(){
history.back() ;
}
function fun2(){
history.go(-2) ;
}
//-->
</script>
<body>
ccccccccccccccc
<a href = "d.html">d.html</a>
<input type="button" value="前进" οnclick="fun()">
<input type="button" value="后退" οnclick="fun1()">
<input type="button" value="直接去a页面" οnclick="fun2()">
</body></html>
d页面:
<script type="text/javascript">
<!--
/*
history对象存储了访问过的页面。
*/
function fun1(){
history.back() ;
}
function fun2(){
history.go(-3) ;
}
//-->
</script>
<body>
ddddddddddddddddd
<input type="button" value="后退" οnclick="fun1()">
<input type="button" value="直接去a页面" οnclick="fun2()">
</body>
</html>