■戻る、進むボタン、指定ページへのジャンプなど履歴の操作をしたい




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>戻る、進むボタン、指定ページへのジャンプなど履歴の操作をしたい</title>
<script type="text/JavaScript">
<!--
function history_disp(){
alert("現在の履歴数は「"+history.length+"」です。")
}
// -->
</script>
</head>
<body>
<p>■戻る、進むボタン、指定ページへのジャンプなど履歴の操作をしたい</p>
<form name="fm1">
<p><input type="button" value="履歴数の表示" onclick="history_disp()"><br><br>
<input type="button" value="<-2ページ戻る" onclick="history.go(-2)">
<input type="button" value="<-1ページ戻る" onclick="history.back()">
<input type="button" value="1ページ進む->" onclick="history.forward()">
<input type="button" value="2ページ進む->" onclick="history.go(2)"></p>
</form>

</body>
</html>


★解説★