首页 > 其他 > 详细

iframe 样式控制

时间:2018-10-03 10:22:22      阅读:185      评论:0      收藏:0      [点我收藏+]
<iframe src="..." scrolling="no" id="iframe"></iframe>
<script> function changeFrameHeight() {   var ifm = document.getElementById("iframe");   var iframeWindow = ifm.contentWindow;   var body = ifm.contentWindow.document.body;   if (iframeWindow.document.readyState == "complete") {     var iframeWidth, iframeHeight;     body.style.cssText = "word-wrap:break-word;";     //获取Iframe的内容实际宽度     iframeWidth = iframeWindow.document.documentElement.scrollWidth;     //获取Iframe的内容实际高度     iframeHeight = iframeWindow.document.documentElement.scrollHeight;     //设置Iframe的宽度     ifm.width = ‘500px‘;     //设置Iframe的高度     ifm.height = iframeHeight;   } } window.onresize = function () {   changeFrameHeight(); } window.onload = function () {   changeFrameHeight(); } </script>

 

iframe 样式控制

原文:https://www.cnblogs.com/Doduo/p/9739172.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!