window.top.location的作用

top, 表示是顶层页面, 因为页面之中可能嵌入了 frame 等子页面,top表示最外面一层

Html代码

<html>  

<head>  

<script type="text/javascript">  

function breakout()   

  {   

  if (window.top!=window.self)    

    {   

    window.top.location="/example/hdom/tryjs_breakout.htm"  

    }   

  }   

</script>  

</head>  

<body>  

 

<input type="button" onclick="breakout()" value="跳出框架!">  

 

</body>  

</html>    

 就是你的顶层网页页面的地址对象。

比如现在这个百度知道的页面,它的location.href 就是

http://zhidao.baidu.com/question/88553493.html

而location, 是一个对象,它包括了上面说的那个地址,还有一些方法,

比如replace(替换地址) 等, 和属性 比如 href (地址)

至于top, 表示是顶层页面, 因为页面之中可能嵌入了 frame 等子页面,top表示最外面一层。

window.top.location的更多相关文章

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

    "window.location.href"."location.href"是本页面跳转. "parent.location.href" 是 ...

  2. window.top.location.href 和 window.location.href 的区别

    window.location.href 是本页面跳转 window.top.location.href是最外层的页面跳转

  3. JQuery的焦点事件focus() 与按键事件keydown() 及js判断当前页面是否为顶级页面 子页面刷新将顶级页面刷新 window.top.location

    相关代码如下,使用看注解 <script type="text/javascript"> if(window.self != window.top){ window.t ...

  4. window.location.href和window.top.location.href的区别

    if (window.location.href == window.top.location.href) {     window.top.location.href = "/index. ...

  5. 如何在window的location使用target

    在页面中window的location跳转时,指定页面在框架中跳转 1. 如果你要让最顶层的框架跳转,就是整个页面,相当于用traget指向顶层 window.top.location   =   & ...

  6. 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法

    "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...

  7. 关于js中"window.location.href"、"location.href"、"parent.location.href"、"top.location.href"的用法

    location.href 和 window.location.href 区别: 1.location.href 可以直接跳转其他地址(不属于本项目) 也可以跳转本项目中的 2.window.loca ...

  8. 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法与区别(跳出iframe方法)

    "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...

  9. 关于js中window.location.href,location.href,parent.location.href,top.location.href的使用方法

    关于js中"window.location.href"."location.href"."parent.location.href".&qu ...

随机推荐

  1. 【leetcode刷题笔记】Find Peak Element

    A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ ...

  2. jenkins添加GIT repository报错

    添加了ssh互信,但一直提示如下错误. Failed to connect to repository : Command "git ls-remote -h git@git.xxx.cn: ...

  3. Django QuerySet API

    https://docs.djangoproject.com/en/2.1/ref/models/querysets/

  4. CentOS 7 安装各个桌面版本

    http://unix.stackexchange.com/questions/181503/how-to-install-desktop-environments-on-centos-7 92dow ...

  5. 一个线程知识点, 一个MongoDB的知识点

    //WINForm窗体中切换前后台线程执行任务: protected void RunOnUI(Action action) { Invoke(action); } protected void Ru ...

  6. ELK分布式日志收集搭建和使用

    大型系统分布式日志采集系统ELK全框架 SpringBootSecurity1.传统系统日志收集的问题2.Logstash操作工作原理3.分布式日志收集ELK原理4.Elasticsearch+Log ...

  7. vs2013 浏览器 browserlink 不停访问

  8. D3.js学习笔记(二)——使用绑定在DOM上的数据

    简单例子 在这个例子中,你将会使用D3.js来将数据绑定到DOM元素上.然后再使用D3.js利用绑定到DOM元素上的数据来更新网页. 在上一章中,我们以下面这个页面作为开始的: <!DOCTYP ...

  9. [Hadoop] - Hadoop 3.x版本新特性

    仅做记录--->官方说明:http://hadoop.apache.org/docs/r3.0.0-alpha2/index.html ============================= ...

  10. yii2:多表查询

    啥都不说了,上代码: $list = static::find() ->leftJoin('book', 'book.RID = prices.RID')->select('prices. ...