Add forward on the page, back (return to the previous level) feature:
Way one: Using functions
<SCRIPT>
function GoBack () {
history.go (-1);// Returns or History.back ();
}
function Go () {
history.go (1);// Forward or History.forward ();
}
</SCRIPT>
Way two:
<a href= "Javascript:history.go (1)" > Forward </a>
<a href= "Javascript:history.go ( -1)" > Back </a>
Easy to doubt the place:
Each page can be set back forward button, only this page jumps to other pages. The Forward button on this page is valid (with the forward direction),
Only the Back button on this page will be valid if the other page jumps to this page ( know the way to go back to the original path ).
(as the forward and backward to have a target direction)
<title> forward, back </title>
<script>
function GoBack () {
History.go (-1);//Return or history.back ();
}
function Go () {
History.go (1);//Forward or history.forward ();
}
</script>
<body>
<a href= "damel8.html" >go to Damel8.html</a>
<br/>
<!--assume that this page (recorded as B) will be returned to the original a page by clicking on the Back button by <a href= "" > </a> by other pages (recorded as page a); Jump back to page a. Suppose you click the Forward button (javascript:history.go (1)) on page A to jump to page B.
Popular speaking:
A page jumps to page B via <a href= "" > </a> etc.
Click the Back button on page B to jump back to page a
Click the Forward button on page A to jump back to page B.
Easy to doubt the place:
Each page can be set back forward button, only this page jumps to other pages, this page of the Forward button is effective (with the direction of the forward),
Only the Back button on this page will be valid if the other page jumps to this page ( knowing the way to go back to the original path ),
(because the forward and backward direction should have a goal.)
。。 Know the way to come back to the original road,)
-
Method One: Use href
<br/>
<a href= "Javascript:history.go (1)" > Forward </a>
Mode two: using function calls
<br/>
<input type= "button" onclick= "GoBack ()" value= "Back"/>
<br/>
</body>
JavaScript effects forward, back (back to previous level)