gpt4 book ai didi

php - iframe 更改 src 后调整主体高度

转载 作者:行者123 更新时间:2023-11-28 03:43:34 25 4
gpt4 key购买 nike

所以我会根据内容高度自动调整 iframe 的大小,如下所示:

<a href="#" onClick="sc.style.height='200px'; window.location.reload(); window.open('19.htm', 'middle'); return false;">Link1</a>
<iframe src="19.htm" name="middle" id="middle" scrolling="no"></iframe>

但是,我使用调整 body 大小的方法没有奏效...

我尝试使用上面的代码来自动调整 body 的高度,以便 iframe 很容易适应页面,因为不同的页面内容具有不同的高度

有什么建议吗?

最佳答案

以下链接包含您需要的信息:Control iframe height with jQuery

使用 jQuery 进行您需要的动态更改是值得的。特别是……

如果您以前没有使用过 jQuery,现在是时候开始了。它让生活变得更轻松。

关于php - iframe 更改 src 后调整主体高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8630697/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com