Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php iframe更改src后调整div的大小_Php_Html_Iframe_Resize_Onclick - Fatal编程技术网

Php iframe更改src后调整div的大小

Php iframe更改src后调整div的大小,php,html,iframe,resize,onclick,Php,Html,Iframe,Resize,Onclick,因此,我会根据内容高度自动调整iframe的大小,如下所示: <iframe name="main" id="main" src="main.php" frameborder=0 scrolling="no" onload="this.style.height = main.document.body.scrollHeight + 5; this.style.width = main.document.body.scrollWidth"> 然而,我也使用一个链接来更改src(如

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

<iframe name="main" id="main" src="main.php" frameborder=0 scrolling="no" onload="this.style.height = main.document.body.scrollHeight + 5; this.style.width = main.document.body.scrollWidth">

然而,我也使用一个链接来更改src(如果有人想知道的话,可以使用target),但是我的iframe高度变化很大,在更改回较短的iframe之后,我调整div/文档体大小的方法没有起作用



有什么建议吗?

如果我修复了双引号,Div resize可以正常工作……问题是在更改源代码后iframe没有调整大小,但现在可以工作了……谢谢

尝试onclick=“document.getElementById(\'content\”).style…或document.getElementById('content'))为了将来的参考,最好把你是如何做到这一点的。。
<a href="mail.php" onclick="document.getElementById("content").style.height = main.document.body.scrollHeight" target="main">