I have an iframe which content is a php-file, and that php-file displays some mysql records.
The more records, the larger the iframe height should get, otherwise it wont show all of the information in the iframe.
Here is a code I have for dynamically setting the iframe height, from the iframes content (the php file):
var x = document.body.scrollHeight;
x = x + 20 + 'px';
window.parent.document.getElementById("iframe001").style.height=x;
iframe001 is the iframe I am referring to above. I am adding 20px of height extra because of borders etc...
Now, sometimes this resizing works, sometimes it doesn't.
Does anybody know why it works sometimes. If I alert the 'x' variable, it shows different values sometimes, but most times it works.
Any other ways you know of setting the iframes height from the content of the iframe?
Thanks