iframe |
您所在的位置:网站首页 › 子窗口调用父窗口方法 › iframe |
参考文章: http://blog.csdn.net/u013299635/article/details/78773207 http://www.cnblogs.com/xyicheng/archive/2010/02/26/1674017.html
父窗口代码 1. 父窗口调用子窗口中的方法test方法 // js document.getElementById("frame").contentWindow.test(); // jq $("#frame")[0].contentWindow.test(); //用jquery调用需要加一个[0]2. 父窗口获取子窗口的值 $("#frame")[0].contentWindow.$("#dd").val();或者 frame.window.$("#dd").val(); var t = document.getElementById('frame').contentWindow.document.getElementById('dd'); $(window.frames["iframe1"].document).find("#id").val(); 3. 子窗口调用父窗口的方法 parent.ggMM(); 4 兄弟窗口方法调用 iframe调用newFrame中的frameFn方法 // js parent.parent.document.getElementById('newFrame').contentWindow.frameFn(); // jq parent.$("#newFrame")[0].contentWindow.frameFn();5.兄弟窗口传值
iframe给newFrame传值
parent.$("#newFrame")[0].contentWindow.$('#nn2').val(); $("#newFrame",parent.document.body).contents().find("someID").val();
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 使用jquery操作iframe 1、 内容里有两个ifame |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |