zoukankan      html  css  js  c++  java
  • 父页面与ifram子页面之间调用

    子页面调用父页面标签

    js

      window.parent.document.getElementById("元素id")

    jquery

      window.parent.$('.theme-popover')

    父页面调用子页面标签

    js

      window.frames["iframe的name值"].document.getElementById("iframe中控件的ID")

    jquery

      $("#iframe中的控件ID",document.frames("frame的name").document).click();

    子页面调用父页面的方法或者变量:

        window.parent.方法()或者变量名
        例如:想在子页面中得到 id 为 aaa 的文本框的值
        window.parent.$("#aaa").val();//这种写法的前提是引用了jquery 
        window.parent.getElementById("aaa").value; //js的写法

    父页面调取子页面 

       主要是通过contentWindow定位到子页面

       document.getElementById("childframe").contentWindow.childtest();
       //调取子页面中的 childtest 方法 js 的写法
       var childWindow = $("#addFrame")[0].contentWindow;    //获取子窗体中的对象
       childWindow.formSubmit();     //调取子页面的formSubmit方法 jquery的写法
       //注释:其中 childframe和addFrame 都时iframe的id

  • 相关阅读:
    sunjiali
    dingding
    xlrd
    Python基础2
    Python常用算法学习
    Python基础1
    分布式监控系统
    堡垒机
    通过Python实现简单的计算器
    Python常用模块学习
  • 原文地址:https://www.cnblogs.com/webmc/p/11097015.html
Copyright © 2011-2022 走看看