关于iframe中的contentWindow, contentDocument
来源:互联网 发布:手机淘宝怎么买游戏号 编辑:程序博客网 时间:2024/04/30 13:02
关于iframe中的contentWindow, contentDocument
2013-10-12 11:37:38| 分类:前端开发 | 标签:iframe 前端 javascript |举报|字号 订阅
如果要在iframe内和父页面传递值,我们该怎么办呢?
contentWindow就是为解决这个而生的。
contentWindow 兼容各个浏览器,可取得子窗口的 window 对象。
contentDocument Firefox 支持,> ie8 的ie支持。可取得子窗口的 document 对象。、
在子级iframe设置 父级 iframe ,或 孙级 iframe 高度。
function showIframeH(){ var parentWin = parent.document.getElementById("test"); if(!parentWin) return false; var sub = parentWin.contentWindow.document.getElementById("test2"); if(!sub) return false; var thirdHeight = sub.contentWindow.document.body.offsetHeight; //第三层 body 对象 sub.height = thirdHeight; //设置第二层 iframe 的高度 var secondHeight = x.contentWindow.document.body.offsetHeight; //第二层 body 对象 x.height = secondHeight; //设置第一层 iframe 的高度 //alert(secondHeight); //alert('body: ' + x.contentDocument.body.offsetHeight + ' div:' + thirdHeight);}
文章源地址:http://www.cnblogs.com/jikey/archive/2011/06/22/2087683.html
0 0
- 关于iframe中的contentWindow, contentDocument
- 关于 contentWindow, contentDocument
- 关于 contentWindow, contentDocument
- 关于 contentWindow, contentDocument
- 关于 contentWindow, contentDocument
- contentWindow 和contentDocument区别 及iframe访问
- JS操作iframe里的DOM || contentWindow,contentDocument
- IFRAMEs, .contentWindow, .contentDocument区别
- contentWindow 和 contentDocument
- contentwindow & contentdocument
- 各浏览器Iframe对contentWindow、contentDocument、document及frames属性测试
- 各浏览器Iframe对contentWindow、contentDocument、document及frames属性测试
- iframe.contentWindow
- iframe的 contentWindow属性
- iframe的contentWindow属性
- iframe.contentWindow 介绍
- iframe.contentWindow 介绍
- contentwindow 和contentdocument dom对象和jquery对象
- IOS开发之格式化日期时间
- Haar特征
- 项目管理最佳实践——石油管道培训记
- XML的学习
- easyui自定义扩展,序号列宽度
- 关于iframe中的contentWindow, contentDocument
- “Unable to execute dex: Multiple dex files define L”问题解决
- 《苏幕遮·怀旧》 范仲淹
- [c++学习]关于typedef的用法总结
- 去除kaptcha的干扰线
- scrapy安装指南
- C++中的static关键字的总结
- linux 下安装redis
- cannot set user id: Resource temporarily unavailable