Home > Web Front-end > JS Tutorial > iframe adaptive height [passed test under IE6 IE7 FF]_javascript skills

iframe adaptive height [passed test under IE6 IE7 FF]_javascript skills

WBOY
Release: 2016-05-16 18:54:17
Original
839 people have browsed it

The first method:

Copy the code The code is as follows:





Second method:
js code :
Copy code The code is as follows:

//iframe adaptive height [under IE6 IE7 Test passed]
function reSetIframe(){
var iframe = document.getElementById("iframeId");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
}

html:
Copy code The code is as follows:


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template