"top.location.href"是最外层的页面跳转
"window.location.href"、"location.href"是本页面跳转
"parent.location.href"是上一层页面跳转.

location是window对象的属性,而所有的网页下的对象都是属于window作用域链中(这是顶级作用域),所以使用时是可以省略window。而top是指向顶级窗口对象,parent是指向父级窗口对象。

window.location是window对象的属性,而window.open是window对象的方法 
  window.location是你对当前浏览器窗口的URL地址对象的参考!   
  window.open是用来打开一个新窗口的函数!

window.open()是可以在一个网站上打开另外的一个网站的地址 
而window.location()是只能在一个网站中打开本网站的网页

window.location或window.open如何指定target? 
这是一个经常遇到的问题,特别是在用frame框架的时候 
解决办法: 
window.location 改为 top.location 即可在顶部链接到指定页 
或 
window.open("你的网址","_top");

<input type="button" value="新窗口打开" onclick="window.open('http://www.baidu.com')"> 
<input type="button" value="当前页打开" onclick="top.location='http://www.baidu.com','_top'">

window location跳转的更多相关文章

  1. window.location.href 和self.location的区别

    你从字面上就可以理解到 window 指的是当前窗口 而 self 指的是自己 在HTML 中 由于页面可以镶嵌页面 所以这2个就有了 区别 比如说 我有个页面A.HTML 里面嵌套了一个B.HTML ...

  2. html中submit和button的区别/ window.location.href 不跳转 的问题

    <input type="button">  <input type="submit"> 这两个的区别 是 button 不会自动提交表 ...

  3. 登陆判读,并跳转到指定页面(window.location.href='http://localhost/index.html')

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 functio ...

  4. 遇到问题-----JS中设置window.location.href跳转无效(在a标签里或这form表单里)

    问题情况 JS中设置window.location.href跳转无效 代码如下: ? 1 2 3 4 5 6 7 8 <script type="text/javascript&quo ...

  5. IE6下window.location.href不跳转到相应url

    前天一同事遇到个看似很诡异的问题,就是<a href="javascript:void(0);" onclick="window.location.href=url ...

  6. 关于window.location不跳转的问题

    今天在码代码的时候遇到个问题:html里采用onclick事件来实现window.location = url的跳转,在内嵌元素上又加上了href="javascrit:;"的属性 ...

  7. window.location.href问题,点击,跳转到首页

    onClick="window.location.href='./';" 点击,跳转到首页. location.href=url Js中实现跳转 window.location.h ...

  8. window.location.href/replace/reload()--页面跳转+替换+刷新

    一.最外层top跳转页面,适合用于iframe框架集 top.window.location.href("${pageContext.request.contextPath}/Login_g ...

  9. springboot 中页面跳转问题:window.location.href

    我的一个HTML页面 点击注册 本该到注册页面,但是却一直跳到同目录的一个Error.html文件夹下 该页面: 删掉Error.html还不行:会报错,而且改变window.location.hre ...

随机推荐

  1. java相差小时数

    public static String getTime(Date date){ StringBuffer time = new StringBuffer(); Date date2 = new Da ...

  2. java-items

    类名Items package entity; //商品类 public class Items { private int id; // 商品编号 private String name; // 商 ...

  3. AngularJS 指令实践指南(一)

    指令(Directives)是所有AngularJS应用最重要的部分.尽管AngularJS已经提供了非常丰富的指令,但还是经常需要创建应用特定的指令.这篇教程会为你讲述如何自定义指令,以及介绍如何在 ...

  4. C# - 怎么截取字符串中指定字符及其后面的字符

    方法1:去掉空格以及后面的字符   //怎么截取让date的值为"2011/12/9",即去掉空格以及后面的字符   string date = "2011/12/9 2 ...

  5. 1.1 React 介绍

    1.1.1 React 是什么 React IS A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES 来自:React 官方网站 狭义来讲 React ...

  6. jQuery 对文档的操作

    通过jquery方式实现页面各种节点的追加.修改.删除.复制等操作 节点追加 1 父子关系追加 /*************************************************** ...

  7. C++的模板

    1. 模板形参表 模板形参表,里面可以是typename T/ class T这种形式的,代表里面被泛化的是一种类型: 也可以使用Type value这种形式的,代表里面被泛化的是一个某种类型的值. ...

  8. img路径错误时,用户友好图片

    img 标签的属性里面添加 onerror="this.src='error友好图片'" 就可以了!

  9. Python翻译

    translator.py # -*- coding: utf-8 -*- # author: inspurer(月小水长) # pc_type lenovo # create_time: 2019/ ...

  10. 通过start.spring.io生成的springboot项目,导入IDE后POM第一行报错

    通过problem控制台查看,显示unknown 尝试降低springboot版本,问题没了,应该是与maven jdk等版本冲突导致 这里JDK 1.8  mave 3.6.1  降低springb ...