Tech Support Forum banner

Loop Script / Parent Document

1212 Views 3 Replies 2 Participants Last post by  enoctis
Ok, I typed out this long message trying to explain what I was attempting to get done. Good thing I realized that chances are I was confusing people. Let me make this as harmless as possible...

I need help with 2 scripts. The first one I want to loop to constantly check the size of the iframe. The script is as follows (and it works now, but doesn't loop):

function resizeToContent(){
     var x =0;
     var y =dynamIframe.document.body.scrollHeight;
     while (x < y){x+=1;}
Of course, the iframe to be resized is given the id "dynamIframe". When this function is called it resizes the iframe. How do I make it loop? I've tried, but failed.

The second work-around that I'm trying to get accomplished (one of these 2 will be better) is the same code as above, except that I want it to check the parent document's iframe as well. The parent document's iframe will have the same ID.

I know it will work because I'm using it now with both iframes (an iframe within another). The problem is that when the content in the sub-iframe changes the iframes won't resize. I can't modify the file that is being loaded into the sub-iframe, therefore, the loop has to be called by the page loaded inside the mainpage (the one that contains the sub-iframe).

Any help is greatly appreciated! If you can only help with one and not the other, that's fine.

Not open for further replies.
1 - 4 of 4 Posts
a good way of doing the loop would be to make a for loop. I'm still lost as to how/why it would constantly be resizing it self for the need of the loop. Can you elaborate more?
elaboration it is...

i have an iframe within an iframe in a design im working on. why? because the first iframe is for the content on my page, while the second contains a bulletin board. i don't want the bulletin board opened in a seperate window, or to replace the mainpage. furthermore, i know that i could eliminate the second (sub) iframe and have the bulletin load in the mainpage's iframe. BUT i want to have other info on the mainpage. the iframes are necessary for the layout i have designed.

but that's not the real problem. the problem is that when the page loads it resizes the iframe (both, actually) to the content within. that's fine & dandy until they click a link inside the iframe. the new content loads - hooray! - but the iframe never resizes...

i REALLY don't want to do this, but if necessary i will go through all of the pages in my bulletin (which is about 200) and add a "onclick" tag to all of the links.

PLEASE don't make me do that, lol.
1 - 4 of 4 Posts
Not open for further replies.