zoukankan      html  css  js  c++  java
  • BOM的history对象

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>history对象</title>
    </head>
    <body>
    <input type="button" value="front" onclick="f1()">
    <a href="history_obj1.html">555</a>
    <script>
    //history内部有三个方法:forward,back,go 一个属性 length
    function f1() {
    // history.forward();
    history.go(1);//history.go(0)代表当前页面
    }


    </script>

    </body>
    </html>
    ======================================================================
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Title</title>
    </head>
    <body>
    <input type="button" value="back" onclick="f2()">
    <script>
    function f2() {
    // history.back();
    history.go(-1);
    alert(history.length);// 2 返回历史URL个数

    }


    </script>

    </body>
    </html>
  • 相关阅读:
    面向对象
    用JS添加和删除class类名
    偶然
    js-cookie的用法
    eleemnt-ui修改主题颜色
    router.go,router.push,router.replace的区别
    vue生产环境清除console.log
    特别关心
    echart
    20182330魏冰妍_预备作业
  • 原文地址:https://www.cnblogs.com/startl/p/12244267.html
Copyright © 2011-2022 走看看