entaroadun
Programmer
I have a problem that I'm sure someone here can clear up. I have a webpage that displays information in an HTML form. My website tracks who makes changes to this info, effectively storing an audit trail of who makes what changes.
To display this I came up with a parent page that contains an IFRAME. I have two buttons above the IFRAME, Current View and Historical View. Clicking on the Current View will load the current iteration of the document in the frame. Clicking on Historical View will load a page with a list of versions.
My problem is how to dynamically size the IFRAME to fit the contents so I don't get scrollbars. That way, someone can print the parent page and it would appear to be one unified document.
The corporate standard browser is IE 5.5 SP2.
I tried setting the CSS overflow attribute of the IFRAME to "visible". Nothing, even though the MSDN states that even IE 4 supports this. Maybe it doesn't work for IFRAMES.
I tried doing it in client-side JavaScript in the onLoad event of the IFRAME. I state 'javascript: this.height = this.document.body.clientHeight'. It came up short and I couldn't figure out what part of the frame content body.clientHeight didn't pick up. Oh well. I played around and found 70px to be the magic number. I tack that onto the height.
When I first load the page, it loads fine: no scrollbars. It appears that the IFRAME is resized beautifully. However, if I click the Current View button (which sets the IFRAME.src = page url) or refresh just the IFRAME itself, it grows.
About 5px is added to the height, which causes a vertical scrollbar to appear. ??? If I do it again, it expands again. This time, the height grows by about 10px and the width expands to fill the page. If I do it again, no further growth.
WTF?
I don't get it. Why does it change after a refresh? When I refresh the parent page, it goes back to the initial load, which is correct. I'm lost...
How do I do what I need? I have explained the concept up above; I don't need to use IFRAMEs. I just want this effect: a page that mimics a tabbed page.
I would rather not load both tabs and hide/show the two pages when the buttons are clicked. Keeping the content on two pages allows me to modularize my ASP. Furthermore, both child pages could potentially have links that will load new pages into the IFRAME. Therefore, it seems like IFRAMEs should be the easiest solution.
Help!
To display this I came up with a parent page that contains an IFRAME. I have two buttons above the IFRAME, Current View and Historical View. Clicking on the Current View will load the current iteration of the document in the frame. Clicking on Historical View will load a page with a list of versions.
My problem is how to dynamically size the IFRAME to fit the contents so I don't get scrollbars. That way, someone can print the parent page and it would appear to be one unified document.
The corporate standard browser is IE 5.5 SP2.
I tried setting the CSS overflow attribute of the IFRAME to "visible". Nothing, even though the MSDN states that even IE 4 supports this. Maybe it doesn't work for IFRAMES.
I tried doing it in client-side JavaScript in the onLoad event of the IFRAME. I state 'javascript: this.height = this.document.body.clientHeight'. It came up short and I couldn't figure out what part of the frame content body.clientHeight didn't pick up. Oh well. I played around and found 70px to be the magic number. I tack that onto the height.
When I first load the page, it loads fine: no scrollbars. It appears that the IFRAME is resized beautifully. However, if I click the Current View button (which sets the IFRAME.src = page url) or refresh just the IFRAME itself, it grows.
About 5px is added to the height, which causes a vertical scrollbar to appear. ??? If I do it again, it expands again. This time, the height grows by about 10px and the width expands to fill the page. If I do it again, no further growth.
WTF?
I don't get it. Why does it change after a refresh? When I refresh the parent page, it goes back to the initial load, which is correct. I'm lost...
How do I do what I need? I have explained the concept up above; I don't need to use IFRAMEs. I just want this effect: a page that mimics a tabbed page.
I would rather not load both tabs and hide/show the two pages when the buttons are clicked. Keeping the content on two pages allows me to modularize my ASP. Furthermore, both child pages could potentially have links that will load new pages into the IFRAME. Therefore, it seems like IFRAMEs should be the easiest solution.
Help!