位置: - 正文

Iframe自适应其加载的内容高度(iframe 自适应宽度和高度)

编辑:rootadmin
<html> <head> <meta http-equiv='Content-Type' content='text/html; charset=gb'> <meta name='author' content='站长中国 <title>iframe自适应加载的页面高度</title> </head> <body> <iframe src="child.htm"></iframe> </body> </html> child.htm: <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=gb'> <meta name='author' content='站长中国 <title>iframe 自适应其加载的网页(多浏览器兼容)</title> <script language=javascript> function iframeAutoFit() { try { if(window!=parent) { var a = parent.document.getElementsByTagName("IFRAME"); for(var i=0; i<a.length; i++) //author:meizz { if(a[i].contentWindow==window) { var h = document.body.scrollHeight; if(document.all) {h += 4;} if(window.opera) {h += 1;} a[i].style.height = h; } } } } catch (ex) { alert("脚本无法跨域操作!"); } } if(document.attachEvent) window.attachEvent("onload", iframeAutoFit); else window.addEventListener('load', iframeAutoFit, false); </script> </head> <body> <div style="width: ; height: ; background-color: yellow"> iframe 自适应其加载的网页(多浏览器兼容) </div> </body> </html>

推荐整理分享Iframe自适应其加载的内容高度(iframe 自适应宽度和高度),希望有所帮助,仅作参考,欢迎阅读内容。

Iframe自适应其加载的内容高度(iframe 自适应宽度和高度)

文章相关热门搜索词:iframe 自适应宽度和高度,iframe嵌套内网页自适应,vue iframe 自适应高度,iframe移动端自适应,iframe嵌入图片自适应,iframe自动适应高度,iframe自动适应高度,iframe 自适应宽度和高度,内容如对您有帮助,希望把文章链接给更多的朋友!

固定右栏宽度, 左栏内容先出现同时自适应宽度的布局 工作原理#wrapper必须触发hasLayout,不然有时里面的内容会浮得怪怪的,我直接用float的,可以用其他方式。其实如果只是要做到这个例子要的效果连#wrapper

转载未知大小的图片在一个已知大小容器中的水平和垂直居中(二) 这是一个未知大小的图片在一个已知大小容器中的水平和垂直居中的例子,原文标题:Centeringanimageofunknownsizeinanoutercontainerofknownsize,作者:StuNichollsform

IE Bug--浮动对象外补丁的双倍距离的解决方法 TheIEDoubledFloat-MarginBugIEBug--浮动对象外补丁的双倍距离先看以下代码:#box{background:ThreedFace;width:px;height:px;}#box1{float:left;background:#F2F2F2;width:px;height:2

本文链接地址:https://www.jiuchutong.com/biancheng/371888.html 转载请保留说明!
下一篇链接:https://www.jiuchutong.com/biancheng/371889.html
免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络