Javascript Tip: Adjust iframe Size to Fit its Contents
Sometimes we put iframe on HTML page and we need to adjust iframe size to fit its contents (iframe source HTML can be very big) ... Below is a small example that demonstrates how to do it:
< html> < head> < title>< /title> < /head> < body> < iframe id="ifr" src="ifr.html">< /iframe>< br /> < input type="button" onclick="document.getElementById('ifr').style.height = ifr.document.body.scrollHeight + 5" value="Ajust" /> < /body> < /html>
Sunday, May 23, 2004 5:31 AM