I recently found a need to have a Javascript auto detect the page height, and width of my iframe i was using on my website.
[CODE]<script>
document.write(‘<iframe width=”‘+(window.innerWidth?window.innerWidth:document.body.clientWidth)+'” height=”‘+(window.innerHeight?window.innerHeight:document.body.clientHeight)+'” src=”report.cfm” name=”content”></iframe>’);
</script>
Is the code I am using, and it works extremely well, however the problem is not only do i need the script to auto-detect the page height, and width, but i need it to only do so to fill up the remaing space, NOT taken up by the navagation at the top. ie, if the Page Display is 1024×768 then i need the iframe to be 900×768
Anyone see where I can improve my code to not only auto detect the window size, but also factor in that it needs to be 124 pixels smaller than the max window height?
full code is here
[CODE]<DIV id=content style=”Z-INDEX: 1; LEFT: 0px; RIGHT: 0px; WIDTH: 1013px; POSITION: absolute; TOP: 69px; HEIGHT: 546px”>
<script>
document.write(‘<iframe width=”‘+(window.innerWidth?window.innerWidth:document.body.clientWidth)+'” height=”‘+(window.innerHeight?window.innerHeight:document.body.clientHeight)+'” src=”report.cfm” name=”content”></iframe>’);
</script>
<!—
<IFRAME src=”report.cfm” frameBorder=0 width=100% height=100% name=”content”>
—>
</DIV>