Iframe

Resizing contents in iframes

iframe code


javscript code
function adjustIFrameSize(id) {  var myiframe = parent.document.getElementById( id ); var pad = 5; if (myiframe.contentDocument && myiframe.contentDocument.body.offsetHeight ) {     //W3C DOM syntax for NN 6 var newH = myiframe.contentDocument.body.offsetHeight; myiframe.height = newH + pad; }   else if (myiframe.Document && myiframe.Document.body.scrollHeight ) {     var newH = myiframe.Document.body.scrollHeight; myiframe.height = newH + pad ; } } Taken from page 134 of Dyanmic HTML: The definitive reference, 2nd edition