skilled1
04-03-2006, 05:49 PM
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.
<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 1024x768 then i need the iframe to be 900x768
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?
<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 1024x768 then i need the iframe to be 900x768
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?