Not quite sure why you want to use an iframe, not a dynamic div populated, say, through ajax, but:
Put the contents in the iframe in the div, and then get the height of the div. I would suggest using jquery like this:
$("#divId").height();
But if you cannot use jquery, you should be able to use this:
document.getElementById("divId").offsetHeight;
Then you need to set the height of the iframe for what you got.
JQuery
$("#iframeId").height($("#divId").height());
regular js:
document.getElementById("iframeId").style.height = document.getElementById("divId").offsetHeight;
Valera
source share