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

How to get the document height?

P: n/a
As I know, the document height is depend on browser and OS usering
using,
is there any way to get the height for that particular document height?

Thank you.

Aug 7 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Cylix wrote:
As I know, the document height is depend on browser and OS usering
using,
is there any way to get the height for that particular document height?

Thank you.
I think this is what you want.....

var cw = document.body.clientWidth;
var ch = document.body.clientHeight;

HTH...

Aug 7 '06 #2

P: n/a
maya wrote:
Cylix wrote:
>As I know, the document height is depend on browser and OS usering
using,
is there any way to get the height for that particular document
height?
I think this is what you want.....
var cw = document.body.clientWidth;
var ch = document.body.clientHeight;
That is way too simple.
From http://www.javascripttoolbox.com/lib/util/index.php you can find this
solution:

// Get the height of the entire document
// --------------------------------------------------------------------
screen.getDocumentHeight = function() {
var body = screen.getBody();
var innerHeight =
(defined(self.innerHeight)&&!isNaN(self.innerHeigh t))?self.innerHeight:0;
if (!document.compatMode || document.compatMode=="CSS1Compat") {
var topMargin = parseInt(CSS.get(body,'marginTop'),10) || 0;
var bottomMargin = parseInt(CSS.get(body,'marginBottom'), 10) || 0;
return Math.max(body.offsetHeight + topMargin + bottomMargin,
document.documentElement.clientHeight,
document.documentElement.scrollHeight, screen.zero(self.innerHeight));
}
return Math.max(body.scrollHeight, body.clientHeight,
screen.zero(self.innerHeight));
};
--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Aug 7 '06 #3

P: n/a
How about if it is a iframe in a table?
The case is I have already set the height of iframe and set the
scrolling bar to to,

That means the overflow content would be hidden at the iframe,
Is it possible to calculate the document height?

Aug 8 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.