如何根据内部内容调整iframe的高度 [英] how to resize iframe height according to the inner content

查看:104
本文介绍了如何根据内部内容调整iframe的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我正在IFrame中加载一个URL.我想调整IFrame的高度以匹配加载内容的高度,而无需滚动.

此URL来自包含数据的Web服务方法.

我该如何实现?

有人可以帮我吗?

谢谢,

Pappu

In my project i am loading a URL in an IFrame. I want to resize the IFrame height to match that of the loaded content without needing to scroll.

This URL is coming from a webservice method that contains data.

how can I achieve this?

can anybody help me?

thanks,

Pappu

推荐答案

我认为从iframe中删除高度字段会将iframe调整为当前内容(URL)
i think removing the height field from iframe will adjust iframe to the current content(URL)


You can dynamically set Every Attribute of IFrame.


<iframe id="Image1" runat="server"></iframe>


And on the code behind you can set attribute as shown below


 protected void Page_Load(object sender, EventArgs e)
    {
Image1.Attributes.Add("height", "150px");
Image1.Attributes.Add("width", "150px");
Image1.Attributes.Add("scrolling", "no");
Image1.Attributes.Add("frameborder", "0");
    }


if this Answer is usefull for you then please vote


这篇关于如何根据内部内容调整iframe的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆