zoukankan      html  css  js  c++  java
  • window.top.location

    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表示最外面一层。
  • 相关阅读:
    CSS选择器
    基础DOS命令
    超链接a标签
    vscode使用技巧
    pc端页面添加meta标签:X-UA-Compatible meta标签
    提问的智慧
    Zepto核心模块源代码分析
    远程调试工具weinre使用教程
    HTML标签marquee实现滚动效果
    git 学习教程
  • 原文地址:https://www.cnblogs.com/baobeiqi-e/p/9884844.html
Copyright © 2011-2022 走看看