iframe 自动延伸的几种方法尝试
来源:互联网 发布:iphone照片美化软件 编辑:程序博客网 时间:2024/05/22 19:16
主界面and 几种js方法:
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>无标题文档</title><style>.left{width:200px;height:500px; background:#9FC; float:left;}.right{width:400px;-height:600px; -background:#0F3; float:left;}</style><script src="jquery-1.8.2.min.js"></script><script>/*function SetWinHeight(obj) { var win=obj; if (document.getElementById) { if (win && !window.opera) { if (win.contentDocument && win.contentDocument.body.offsetHeight) win.height = win.contentDocument.body.offsetHeight; else if(win.Document && win.Document.body.scrollHeight) win.height = win.Document.body.scrollHeight; } } } *//*function iFrameHeight() { var ifm= document.getElementById("iframepage"); var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument; if(ifm != null && subWeb != null) { ifm.height = subWeb.body.scrollHeight; } } *//*function dyniframesize(down) { var pTar = null; if (document.getElementById){ pTar = document.getElementById(down); } else{ eval('pTar = ' + down + ';'); } if (pTar && !window.opera){ //begin resizing iframe pTar.style.display="block" if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){ //ns6 syntax pTar.height = pTar.contentDocument.body.offsetHeight +20; pTar.width = pTar.contentDocument.body.scrollWidth+20; } else if (pTar.Document && pTar.Document.body.scrollHeight){ //ie5+ syntax pTar.height = pTar.Document.body.scrollHeight; pTar.width = pTar.Document.body.scrollWidth; } } } */function SetCwinHeight() { var iframeid = document.getElementById("maincontent1"); //iframe id iframeid.height = "10px";//先给一个够小的初值,然后再长高. if (document.getElementById) { if (iframeid && !window.opera) { if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight) { iframeid.height = iframeid.contentDocument.body.offsetHeight; } else if (iframeid.Document && iframeid.Document.body.scrollHeight) { iframeid.height = iframeid.Document.body.scrollHeight; } } } } </script></head><body><div><div class="left"></div> <div class="right"> <!-- <iframe src="2.html" width=100% align="center" id="win" name="win" onload="Javascript:SetWinHeight(this)" frameborder="0" scrolling="no" ></iframe> <iframe src="2.html" id="iframepage" name="iframepage" frameBorder=0 scrolling=no width="100%" onLoad="iFrameHeight()" ></iframe> <iframe src="2.html" frameborder="0" marginheight="0" marginwidth="0" frameborder="0" scrolling="auto" id="ifm" name="ifm" onload="javascript:dyniframesize('ifm');" width="100%"></iframe> --> <iframe style="z-index: 1; visibility: inherit; width: 100%;" name="maincontent1" onload="Javascript:SetCwinHeight()" height="1" id="maincontent1" src="2.html" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe> </div></div></body></html>
子界面就是赋值了一个高:
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>无标题文档</title><style>.box{width:100%;height:1500px; background:#9F0;}</style></head><body><div class="box"></div></body></html>
经过测试可以使用,不过没有测试所有的浏览器就试了ie
0 0
- iframe 自动延伸的几种方法尝试
- iframe的自动延伸问题
- 页面自动延伸的方法
- jquery 操作iframe的几种方法
- jquery 操作iframe的几种方法
- Jquery Javascript 取得iframe中元素的几种方法
- Jquery取得iframe中元素的几种方法
- Jquery取得iframe中元素的几种方法
- Jquery取得iframe中元素的几种方法
- Jquery取得iframe中元素的几种方法
- Jquery取得iframe中元素的几种方法
- query取得iframe中元素的几种方法
- 解析Jquery取得iframe中元素的几种方法
- jquery 操作iframe的几种方法总结_jquery_
- js/jquery 操作iframe的几种方法
- 解析Jquery取得iframe中元素的几种方法
- Jquery取得iframe中元素的几种方法…
- query取得iframe中元素的几种方法
- eclipse编译出错
- Solr的下载、安装、验证
- POJ 3617 best cow line 贪心法
- Xcode LLDB Debug教程
- 源码的管理
- iframe 自动延伸的几种方法尝试
- Dormi婴儿监控器:让手机帮你看管婴儿
- Web工程师的工具箱
- 远程桌面下如何打开Windows任务管理器
- UML—活动图
- 移植linphone到arm-linux日志记录
- 开源C/C++网络库比较 ace &&bosst
- 还在纠结学习什么语言吗
- 法庭记录流出:乔布斯曾如此威胁Palm CEO,但人家没屈服