zoukankan      html  css  js  c++  java
  • iframe 传值问题

    当一个页面中插入了iframe或者由不同的框架组成(fieldset)时,这种情况下,需要处理的业务逻辑比较常见的就是数据进行交互了

    1.页面中插入了iframe情况

    由于页面中插入了iframe,那么iframe就是一种从属于主窗体的关系
    当一个页面中插入了iframe或者由不同的框架组成(fieldset)时,这种情况下,需要处理的业务逻辑比较常见的就是数据进行交互了

    1.页面中插入了iframe情况

    由于页面中插入了iframe,那么iframe就是一种从属于主窗体的关系

    主窗体要取得iframe中的值:window.frames["iframe的名字"].document.getElementById("");

    iframe要取得主窗体中的值:window.top.document.getElementById("");

    iframe要取得iframe的值:window.top.frames["iframe的名字"].document.getElementById("");

    2.页面由<fieldset></fieldset>组成

    页面间的关系都是平等的

    假如存在topFrame和mainFrame

    topFrame要取得mainFrame中的值:window.top.frames["mainFrame"].document.getElementById("");

    备注:上面的top都是直接定向于主窗体

    主窗体要取得iframe中的值:window.frames["iframe的名字"].document.getElementById("");

    iframe要取得主窗体中的值:window.top.document.getElementById("");

    iframe要取得iframe的值:window.top.frames["iframe的名字"].document.getElementById("");

    2.页面由<fieldset></fieldset>组成

    页面间的关系都是平等的

    假如存在topFrame和mainFrame

    topFrame要取得mainFrame中的值:window.top.frames["mainFrame"].document.getElementById("");

    备注:上面的top都是直接定向于主窗体

    在页面中引入iframe,parent跟top的作用是一样的。
    但是在<fielde>情况下,parent是父窗体,top是顶级窗体

  • 相关阅读:
    单例模式(上)单例常见的实现方式
    Netty(六)揭开 BootStrap 的神秘面纱
    Netty(五)Netty 高性能之道
    Netty(四)基于Netty 的简易版RPC
    Netty(三)基于Bio和Netty 的简易版Tomcat
    Netty(二)Netty 与 NIO 之前世今生
    java学习笔记
    Java使用笔记之对象比较
    React学习之受控和非受控组件
    SpringBoot学习之常用注解
  • 原文地址:https://www.cnblogs.com/guozhe/p/3806276.html
Copyright © 2011-2022 走看看