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. MySQL DDL方案测试及选型.

    性能测试 一.测试背景 1.机器配置和版本 机器配置(下面测试qps数据都是以本机器配置为准) 型号:Dell s3710 磁盘:SSD 3T CPU:32 内存:128G MySQL版本:5.7.2 ...

  2. NET中IL指令详解

    名称 说明 Add 将两个值相加并将结果推送到计算堆栈上. Add.Ovf 将两个整数相加,执行溢出检查,并且将结果推送到计算堆栈上. Add.Ovf.Un 将两个无符号整数值相加,执行溢出检查,并且 ...

  3. Tomcat:解决Tomcat可以在eclipse启动,却无法显示默认页面的操作

    解决Tomcat可以在eclipse启动,却无法显示默认页面的操作 今天在eclipse中配置好tomcat后访问不到它的主页,但是能运行自己的项目,一直找不到原因,百度之后最后解决了这个问题,总结如 ...

  4. 《Pro Git》第2章 Git基础

    1.获取Git仓库 1.1从现有的目录中初始化仓库 进入项目目录,git init,会创建一个名为.git的子目录 1.2克隆现有的仓库 git clone [url],会将远程Git仓库中的每一个文 ...

  5. xcode9打包问题

    xcode9打包找不到icon http://blog.csdn.net/yohunl/article/details/78065656 换用xcode8打包 https://www.cnblogs. ...

  6. Spring_通过工厂方法配置 Bean

    beans-factory.xml <?xml version="1.0" encoding="UTF-8"?><beans xmlns=&q ...

  7. [BZOJ1721][Usaco2006 Mar]Ski Lift 缆车支柱

    Description Farmer Ron in Colorado is building a ski resort for his cows (though budget constraints ...

  8. PHP 404伪装

    <?php function GetCurUrl() { if(!empty($_SERVER["REQUEST_URI"])) { $scriptName = $_SERV ...

  9. Nginx配置端口访问的网站

    server { listen 80; #listen [::]:80 default_server ipv6only=on; server_name www.website.com; index i ...

  10. TF卡.购买(20180925)

    1.准备买 2个 一个 用于 老的手机"红米Note",一个用于现在我的手机"红米Note4X". 之前,这2个手机都是用的 那个坏掉的64g的tf卡 2.刚问 ...