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. 【Head First Servlets and JSP】笔记21:从有脚本到无脚本

    可以建立多态的bean引用吗 使用type,但没有class scope属性默认为“page” 从有脚本到无脚本 1.快速搭建一个测试环境:输入用户名,返回“Hello, 用户名” index.htm ...

  2. Oracle 集合操作

    在 Oracle 中提供了三种类型集合操作:并(UNION).交(INTERSECT).差(MINUS) · UNION:将多个查询的结果组合到一个查询结果之中,没有重复内容 · UNION ALL: ...

  3. Keras实现autoencoder

    Keras使我们搭建神经网络变得异常简单,之前我们使用了Sequential来搭建LSTM:keras实现LSTM. 我们要使用Keras的functional API搭建更加灵活的网络结构,比如说本 ...

  4. Kotlin 卸载APP自身

    package com.example.batdw01.myapplication import android.net.wifi.WifiManager import android.support ...

  5. github上十二款最著名的Android播放器开源项目

    1.ijkplayer 项目地址: https://github.com/Bilibili/ijkplayer 介绍:Ijkplayer 是Bilibili发布的基于 FFplay 的轻量级 Andr ...

  6. Django进阶Model篇007 - 聚集查询和分组查询

    接着前面的例子,举例聚集查询和分组查询例子如下: 1.查询人民邮电出版社出了多少本书 >>> Book.objects.filter(publisher__name='人民邮电出版社 ...

  7. mysql中的左连接右连接内连接

    一. 初始化SQL语句 /*join 建表语句*/ drop database if exists test; create database test; use test; /* 左表t1*/ dr ...

  8. [csharp] bool IsNumeric(Type type)

    /* "C:\Program Files (x86)\MSBuild\14.0\Bin\csc.exe" /out:IsNumericType.exe IsNumericType. ...

  9. uva 11825 巧妙地子集枚举方法

    https://vjudge.net/problem/UVA-11825 题目大意,有n台服务器,有n种服务,每台服务器都运行着所有的服务,一台服务器可以被攻击一次其中的一种服务,当你选择攻击某台服务 ...

  10. Ceph Monitor的数据管理

    转自:https://www.ustack.com/blog/ceph-monitor-2/ Monitor管理了Ceph的状态信息,维护着Ceph中各个成员的关系,这些信息都是存放在leveldb中 ...