JavaScript DHTML/Javascript Objects/history
Содержание
A Browser History Count
<source lang="html4strict">
<html> <head> <title>History Object</title> <script type="text/javascript"> function showCount() {
var histCount = window.history.length; if (histCount > 2) { alert("You have been to " + histCount + " Web pages this session."); }
} </script> </head> <body> <form> <input type="button" name="activity" value="My Activity" onclick="showCount()" /> </form> </body> </html>
</source>
history back
<source lang="html4strict">
<html> <head> <script language="JavaScript"> function function1(){
history.back(1);
} </script></head> <body> <input id="myButton"
type="button" onclick="function1();" value="Go back 1 step in the history list">
</body> </html>
</source>
History.go(-2)
<source lang="html4strict">
<html> <head> <title>History</title> </head> <body>
history object
<a href="" onclick="history.back();return false">history.back()</a>
<a href="" onclick="history.go(-2);return false">history.go(-2)</a>
<a href="" onclick="history.forward();return false">history.forward()</a>
</script>
</body>
</html>
</source>
History length
<source lang="html4strict">
<html> <body> <button onclick="alert(window.history.length);">History Length</button> </body> </html>
</source>
Hsitory.forward()
<source lang="html4strict">
<html> <head> <title>History</title> </head> <body>
history object
<a href="" onclick="history.back();return false">history.back()</a>
<a href="" onclick="history.go(-2);return false">history.go(-2)</a>
<a href="" onclick="history.forward();return false">history.forward()</a>
</script>
</body>
</html>
</source>
<source lang="html4strict">
<html> <head> <title>history.go() Method</title> <script type="text/javascript"> function doGoNum(form) {
window.history.go(parseInt(form.histNum.value));
} function doGoTxt(form) {
window.history.go(form.histWord.value);
} </script> </head> <body> <form> Calling the history.go() method:
Enter a number: <input type="text" name="histNum" size="3" value="0" /> <input type="button" value="Go to Offset" onclick="doGoNum(this.form)" />
Enter a word in a title:<input type="text" name="histWord" /> <input type="button" value="Go to Match" onclick="doGoTxt(this.form)" />
</form> </body> </html>
</source>