zoukankan      html  css  js  c++  java
  • 前端实现返回上一层页面

    当前的页面的url下标为0,所以window.history.go(-1) 就是要定位到相对页面下表为-1的页面, 也就是之前刚刚访问的页面;
    //返回上一页:
    window.history.go(-1);
    
    //返回上两个页面:
    window.history.go(-2);
    window.history.back(-1)和windos.history.go(-1) 都是返回之前的页面 但是方法不同 所以也有所区别:
      window.history.back(-1)//直接返回当前页的上一页,数据全部消失,是个新页面
      window.history.go(-1)//也是返回上一页面,不过表单的数据还在
    项目经验实例:  
      <button type="button" class="btn btn-danger" style="position:relative; float:right;bottom:49px;"
    onclick="javascript:window.history.go(-1)">返回

    总结:  

        <input type=button value=刷新 onclick="window.location.reload()">

        <input type=button value=前进 onclick="window.history.go(1)">

        <input type=button value=后退 onclick="window.history.go(-1)">

        <input type=button value=前进 onclick="window.history.forward()">

        <input type=button value=后退 onclick="window.history.back()"> //后退+刷新








  • 相关阅读:
    数据科学 R语言速成
    F#周报2019年第29期
    F#周报2019年第28期
    F#周报2019年第27期
    F#周报2019年第26期
    F#周报2019年第25期
    F#周报2019年第24期
    F#周报2019年第23期
    .NET工程师的书单
    F#周报2019年第22期
  • 原文地址:https://www.cnblogs.com/We612/p/10231767.html
Copyright © 2011-2022 走看看