您当前的位置:
FineReport帮助文档 - 全面的报表使用教程和学习资料
>>
iframe 嵌入报表滚动条问题
>> 历史版本
历史版本1 :iframe 嵌入报表滚动条问题
返回文档
编辑时间:
11-11 09:50
历史版本:
最新历史版本
下一篇历史版本
内容长度:
4267
图片数:
2
目录数:
2
修改原因:
修正错误
一个网页中嵌入了一个iframe,iframe中嵌入一张报表,当报表大小超过iframe大小时,iframe中就会出现滚动条;当iframe超过浏览器大小时,浏览器便会出现滚动条,就是下图这种效果。
目录:
1. 实现原理
2. 实现步骤
1. 实现原理
编辑
如果我们横向与纵向都只想保留一个滚动条,应该怎么做呢?首先我们来看一下iframe的定义方式:
</div><div class="doc_description" style="color: rgb(56, 56, 56); text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; line-height: 22px;">其中height、width决定了iframe的大小,其值有两种写法:</div><div class="doc_description" style="color: rgb(56, 56, 56); text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; line-height: 22px;"><span class="doc_sql" style="font-weight: bold; color: rgb(95, 158, 160);">height=100%</span>相对于浏览器的百分比</div><div class="doc_description" style="color: rgb(56, 56, 56); text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; line-height: 22px;"><span class="doc_sql" style="font-weight: bold; color: rgb(95, 158, 160);">height="800"</span>实际像素值</div><div class="doc_description" style="color: rgb(56, 56, 56); text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; line-height: 22px;"><span class="doc_sql" style="font-weight: bold; color: rgb(95, 158, 160);">frameborder="0"</span>设置HTML框架边框的显示方式,0则表示没有边框</div><div class="doc_h1" style="font-weight: bold; font-size: 16px; color: rgb(56, 56, 56); line-height: 11px; margin-top: 20px; margin-bottom: 16px;"> </div> <a class="mylink clr" name="3" href="javascript:"></a> <div class="nei_main1"><h2 class="para-title level-2"><span class="title-text">2. 实现步骤</span><a class="edit-icon" href="doc-editsection-935-3.html" >编辑</a></h2></div> <div class="content_topp"> </div><div class="doc_description" style="color: rgb(56, 56, 56); text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; line-height: 22px;">如果用实际像素值来定义iframe的大小,就可能出现iframe比浏览器大的情况。因此这个问题的解决方法就是,定义iframe大小时使用百分比来定义,这样确保iframe始终在浏览器内,只有iframe中才可能会出现滚动条,如下图所示的效果,就只有一组滚动条了。</div><div class="doc_description" style="color: rgb(56, 56, 56); text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; line-height: 22px;"><img src="/uploads/201511/14472066418RWX2vHA.png" style="padding: 10px 0px 5px;" /></div><div class="doc_h2" style="font-weight: bold; font-size: 15px; color: rgb(56, 56, 56); margin-top: 11px; margin-bottom: 11px;"><div class="hdwiki_tmmll">2.1 其它问题</div></div><p></p><div class="doc_description" style="color: rgb(56, 56, 56); text-indent: 22px; text-align: justify; margin-top: 5px; margin-bottom: 5px; font-family: 微软雅黑; line-height: 22px;">其中使用谷歌浏览器还是会有滚动条,因为body默认有margin属性,谷歌计算iframe的宽度时去掉margin了,但是计算高度时没去掉,所以页面集成时需要修改body属性,加上<span class="doc_sql" style="font-weight: bold; color: rgb(95, 158, 160);">style="margin:0px"</span>。</div> </div> </div> </div> </div> </div> </body> </html>