iframe子窗口父窗口方法调用和元素获取

1、父窗口调用iframe里面的方法

  iframename.window.method();

2、子窗口调用父窗口方法

  parent.window.method();

3、父窗口获取iframe里面元素

  $("#id",document.frames["iframename"].document);

4、子窗口获取父窗口元素

  $("#id",parent.document);

时间: 2024-07-28 16:43:16

iframe子窗口父窗口方法调用和元素获取的相关文章

用jQuery在IFRAME里取得父窗口的某个元素的值

收集网上的一些示例: 用jQuery在IFRAME里取得父窗口的某个元素的值 只好用DOM方法与jquery方法结合的方式实现了 1.在父窗口中操作 选中IFRAME中的所有单选钮 $(window.frames["iframe1"].document).find("input[@type='radio']").attr("checked","true"); 2.在IFRAME中操作 选中父窗口中的所有单选钮 $(window

通过js检测到iframe,使父窗口重定向到index -----------???----------------------

通过js检测到iframe,使父窗口重定向到index -----------???---------------------- 如果本身已将在iframe中,那么重定向的页面应该直接添加到父级iframe中-----???----

jQuery在iframe里取得父窗口的某个元素的值

提供一款jQuery在iframe里取得父窗口的某个元素的值实现,这个iframe用js也差不多,有需要的朋友可以参考一下. 1.在父窗口中获取指定iframe(testiframe) id 为 testid 的class $(window.frames["testiframe"].document).find("#testid").attr('class'); 2.在IFRAME中获取父窗口中id为testid的class $(window.parent.docu

关于Mdi窗口-父窗口上的控件把子窗口的挡住的问题

using System.Runtime.InteropServices; [DllImport("user32")] public static extern int SetParent(int hWndChild, int hWndNewParent); ///temp2是你的子form temp2.MdiParent = this; temp2.Show(); SetParent((int)temp2.Handle, (int)this.Handle); 原文:http://to

iframe子页面js调用父页面js函数/父页面调用Iframe子页面中js方法

1.假设当前页面为a.html, iframe的src页面为b.html,其代码如下: 1 <span class="tag"><html> 2 <br></span><span class="tag"><head> 3 <br></span><span class="tag"><title></span><s

[ucgui] 子窗口父窗口

它创建了3个窗口: 第一个作为桌面的子窗口 第二个作为第一个窗口的子窗口 第三个作为第二个窗口的子窗口 窗口创建后,使用WM_ForEachDesc()在其父窗口中移动各个窗口: 1 static void _cbWin(WM_MESSAGE * pMsg) { 2 GUI_COLOR Color; 3 switch (pMsg->MsgId) { 4 case WM_PAINT: 5 WM_GetUserData(pMsg->hWin, &Color, 4); 6 GUI_SetBk

父窗口调用iframe子窗口方法

一.父窗口调用iframe子窗口方法 1.HTML语法:<iframe name="myFrame" src="child.html"></iframe> 2.父窗口调用子窗口:myFrame.window.functionName(); 3.子窗品调用父窗口:parent.functionName(); 简单地说,也就是在子窗口中调用的变量或函数前加个parent.就行 4.父窗口页面源码: 复制代码 代码如下:<html> &

JavaScript(Iframe、window.open、window.showModalDialog)父窗口与子窗口之间的操作

一.Iframe 篇 公共部分 //父对象得到子窗口的值 //ObjectID是窗口标识,ContentID是元素ID function GetValue(ObjectID,ContentID) { var IsIE = (navigator.appName == 'Microsoft Internet Explorer') if(IsIE) {//如果是IE alert(document.frames(ObjectID).document.getElementById(ContentID).i

iframe中子父窗口互调的js方法

转载自:http://www.cnblogs.com/chinafine/archive/2011/09/15/2177746.html 一.父窗口调用iframe子窗口方法 1.HTML语法:<iframe name="myFrame" src="child.html"></iframe> 2.父窗口调用子窗口:myFrame.window.functionName(); 3.子窗品调用父窗口:parent.functionName();