I have a form built with Form Builder. I am showing the form in an iframe
. How can I calculate the forms height so I can pass it to the iframe
and as result have no vertical scroll bar on the iframe
but only on the main window.
I tried calling this method on onload event of the iframe
:
function setSize() {
var iFrame = document.getElementById("myIframe");
if (iFrame.contentDocument) {
//FF 3.0.11, Opera 9.63, and Chrome
iFrame.height = iFrame.contentDocument.documentElement.scrollHeight + 30;
} else {
//IE6, IE7 and Chrome
iFrame.height = iFrame.contentWindow.document.body.scrollHeight + 30;
}
}
But this doesn't work because the content of the iframe
isn't ready yet (if I call the method on button click everything works fine). Is their another way to achieve this? Is their an event when the form is fully initialized?