[Javascript] iframe size (may be an HTML issue)

Peter Brunone peter at brunone.com
Fri Jan 30 15:04:03 CST 2004


	Wow... how tall is a three-gallon bag of water?

	If you know the width, maybe you can get the body as a string
and count the number of characters... But that isn't really a reliable
number since resolutions, font sizes, and invisible text may be a factor
(although I suppose you could mitigate the last one by counting the
.innerText characters of every element in the doc).  Why is it necessary
to avoid scrolling?

Cheers,

Peter

-----Original Message-----
From: javascript-bounces at LaTech.edu On Behalf Of Chris Basken

Silly question time.

If I'm pulling another HTML doc into an iframe, is it possible to set
the iframe's height to fit the content of the HTML doc?  This is a
template page that uses JS to define the src of the iframe depending on
another parameter, but different src docs have different lengths and I'd
like to avoid scrolling.

I know I can use:

    document.all['myIframe'].style.height = x;

So I need to determine x from the content of the HTML doc that's being
pulled in, but that would depend on how it flowed, so I can't really
know that ahead of time (each such doc has a master table, so I can
match widths, but how do I determine the height?).





More information about the Javascript mailing list