By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,916 Members | 1,078 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,916 IT Pros & Developers. It's quick & easy.

javascript in containers (iframe)

P: n/a
I want to know the recommended way to handle scripting of/with
containers such as an iframe. I have a page with border-navigation
bars on the top/bottom/left/right and I want to use an iframe to load
content in the middle.

I would like, if possible, to have the parent window resize itself to
suit whatever is loaded into the iframe container, deriving the size
needed from calculated values. Thus the calculation would have to
over-ride default and/or previous settings for the size of the initial
iframe after all of the associated container content has been fully
loaded and rendered.

Any information and assistance is appreciated.

KL

P.S. Also, as a side note... I have noticed some less than favorable
results in netscape for deriving calculated size as well as iffy
ability to force and/or calculate the height of such content to fully
fill the frame. Any tips on how to force said content to fully fill
and/or expand the container vertically would also be appreciated.
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <5f**************************@posting.google.com >,
kl*****@hotmail.com (Catherine Lynn Smith) writes:
I want to know the recommended way to handle scripting of/with
containers such as an iframe. I have a page with border-navigation
bars on the top/bottom/left/right and I want to use an iframe to load
content in the middle.

I would like, if possible, to have the parent window resize itself to
suit whatever is loaded into the iframe container, deriving the size
needed from calculated values. Thus the calculation would have to
over-ride default and/or previous settings for the size of the initial
iframe after all of the associated container content has been fully
loaded and rendered.

Any information and assistance is appreciated.
Set the IFrames width and height, same as you would a normal frame (if there is
such a thing). document.frames['IFrameName'].widht/height
KL

P.S. Also, as a side note... I have noticed some less than favorable
results in netscape for deriving calculated size as well as iffy
ability to force and/or calculate the height of such content to fully
fill the frame. Any tips on how to force said content to fully fill
and/or expand the container vertically would also be appreciated.


http://webtips.dan.info/force.html
--
Randy
Jul 20 '05 #2

P: n/a
hi************@aol.com (HikksNotAtHome) wrote in message news:<20***************************@mb-m27.aol.com>...
In article <5f**************************@posting.google.com >,
kl*****@hotmail.com (Catherine Lynn Smith) writes:
I want to know the recommended way to handle scripting of/with
containers such as an iframe.

I would like, if possible, to have the parent window resize itself to
suit whatever is loaded into the iframe container, deriving the size
needed from calculated values. Thus the calculation would have to
over-ride default and/or previous settings for the size of the initial
iframe after all of the associated container content has been fully
loaded and rendered.

Any information and assistance is appreciated.


Set the IFrames width and height, same as you would a normal frame (if there is
such a thing). document.frames['IFrameName'].widht/height


I do intilize the iframe with a standard size then have it resize to
fit the size of the browser. Currently, the border design is built
around an 800x600 window size so I set a 'minimum' value for the x and
y that if the browser is made smaller than this amount, the border
content 'stops' getting smaller and the scroll bars thus turn on to
provide panning.

Due to the size of the borders, however, the center content area ends
up being only about 500x400 in size and some of the pages I want to
load into that iframe are going to need more size than this. I would
like, if it is possible, to 'read' the calculated minimum 'width' and
'size' from the iframe content after it is reloaded then reset the
minimum values for the total parent window size based on this center
content minimum width and height.

I currently have the scroll bars turned off on the iframe, and would
thus like to reset the minimum and redraw the borders so the parent
window scroll bars will facilitate panning of the entire page (center
content in the iframe + the borders on the parent window) but I am not
sure how to:

1) have the browser derive the 'needed' minimum size for the iframe
prior to doing any resizing of the parent window. (due to the fact
the iframe size is previously 'fixed' in size, any values I have tried
to extract from the DOM relate to it's present size)
2) I am still a tad confused on the scope between the iframe and the
parent window as far as navigating the DOM nodes is concerned or the
variables and assignments in the javascripting.

I am guessing that it may be necessary to hard code the sizing
requirements somewhere in all the center content pages which I would
like to avoid if possible should there be any way to derive the
necessary sizing values from calculated properties. But even if I
hard code or find a way to extract the necessary parameters, I am
still unclear on how to pass that information to the parent window or
extract the values from the iframe.

KL
Jul 20 '05 #3

P: n/a
As an addendum, while waiting for my message to post and to get any
consequent replies, I have figured out how to read the properties
either from the internal content or from the parent frame. But that
still leaves me with the javascript scope questions.

One of my goals is to try to leave the pages loaded into the center
area as 'dumb' as possible (i.e. the less parent specific nonsense in
them the better as I will probably create a wrapper or at least a test
to send people too lazy to upgrade their browsers off to these pages
directly rather than load them into my border page)

Now that I am able to read and set the values I need, I need to figure
out how to trigger the actually event to resize them. Of course, the
simplest would be an 'onload' event in the HTML of the child page
being loaded into the iframe, but as I just mentioned, I want to avoid
any parent specific coding if possible in those content pages.

Is there a way to trigger a function call 'from the parent page' when
the iframe (child) is done loading and rendering?

KL
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.