JS_ヒストリ記録の対象

10102 ワード


<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>History  title>
head>
<body>
    <a href="09_History  _Test.html">Test  a>
    <input type="button" value="  " id="forwardBtn">


<script>
    /*
    History       

    1.   
        window.history       :history

    2.   
        back()            URL     
        forward()         URL     
        go(n)         n   :    n URL     ;  n   :    n URL     ;

    3.   
        length                     URL  

     */


    // forward()         URL     
    var forwardBtn = document.getElementById("forwardBtn");
    forwardBtn.onclick = function () {
        // history.forward();
        history.go(1);  // go(n)         n   :    n URL     ;  n   :    n URL     ;
    };


    // length                     URL  
    var length = history.length;
    document.write(length + "");    //   document            , length   ,       + ""     length      

script>
body>
html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>History  _Testtitle>
head>
<body>
    <input type="button" value="  " id="bakBtn">


<script>
    // back()            URL     
    var bakBtn = document.getElementById("bakBtn");
    bakBtn.onclick = function () {
        // history.back();
        history.go(-1); // go(n)         n   :    n URL     ;  n   :    n URL     ;
    };

script>
body>
html>