zoukankan      html  css  js  c++  java
  • js实现页面跳转的几种方式

    window.location.replace("http://www.baidu.com");    //没有后退功能
    window.location.assign("http://www.baidu.com");     //可以返回到前一操作页面
    window.location.href="http://www.baidu.com";        //可以返回到前一操作页面
    window.open("http://www.baidu.com");                    //打开一个新的页面
    window.history.back(-1);   //返回上一页面
    window.navigate(" http://www.baidu.com ");           //可以返回到前一操作页面 
    self.location="http://www.baidu.com";
    top.location="http://www.baidu.com"; //整个页面跳转


    PS:以上方式虽然都可以实现跳转,但部分还是有区别,比如跳转之后是否可以返回到上一页面
    ,值是写在“=”后面还是“()”里面 如:href="",assign("");

  • 相关阅读:
    python 函数2
    python 函数
    python 中string格式化
    python中的集合
    值&&引用传递&&序列化
    线程&&进程
    c#委托
    .net框架介绍
    类的定义
    ef中关于数据库中int为null问题
  • 原文地址:https://www.cnblogs.com/itmyhome/p/4131386.html
Copyright © 2011-2022 走看看