Reputation: 3264
I need to access an id found inside an iframe. I have the following code:
print "<IFRAME id='preview_iframe_form' ... src=\"$server_url/index.cgi ";
Inside index.cgi, I have the following :
print"<div id='result_div'>";
&show_list();
print "</div>";
I need to check the result_div height so set the height of preview_iframe_form
Upvotes: 0
Views: 106
Reputation: 560
Try this:
var iframe = document.getElementById('preview_iframe_form');
var iframedoc = iframe.contentWindow ? iframe.contentWindow.document : iframe.contentDocument;
var resultEl = iframedoc.getElementById('result_div');
Upvotes: 1