function adjustIFramesHeightOnLoad(iframe) {
var iframeHeight = Math.min (iframe.contentWindow.window.document.documentElement.scrollHeight, iframe.contentWindow.window.document.body.scrollHeight);
$(iframe).height(iframeHeight);
}
I won’t talk about the failed test, let’s get straight to it.
Two links and iframe:
Personal Information Modify password
js code:
The find("#content") here is to find the height of the id of content in the iframe content document (another example is find("body")), and set it to the iframe,
Similarly, you can also set the width, leave it to friends who need it to try.
This solves the problem that the iframe will not be blocked due to excessive content (because I set scrolling="no").
PS: Basically, I will give priority to using iframe to achieve no refresh and be compatible with the browser's back button; and it is very cool to use iframe to load flash. There is no need to write any js calls or object tags, and it also complies with W3C standards.
November 28, 2008 17:13:31, some improvements were made according to the actual situation during use today, the code is as follows:
I also found that using find("body") is not easy to use and is highly inaccurate.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn