473,388 Members | 1,557 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Retrieve required height of page

How can I retrieve the required height of a page to fit in my current
browser window's width such that I don't need the vertical scrollbar to
see the full contents of the page? In other words, I need the
document's height.

Furthermore, I need to figure out how to do this in IE6 w/o switching
to strict mode (so, the default IE6 mode = quirks).

Chad

Sep 29 '06 #1
4 7392
This may help...
var windowWidth;
var windowHeight;

if(window.addEventListener) {
windowWidth = window.innerWidth;
windowHeight = window.innerHeight;
}
else {
windowWidth = document.documentElement.clientWidth ||
document.body.clientWidth;
windowHeight = document.documentElement.clientHeight ||
document.body.clientHeight;
}

The top part is for web browsers and the bottom is for Intranet
Explorer.

I use that all the time for my JavaScript window apps...

CWaldman wrote:
How can I retrieve the required height of a page to fit in my current
browser window's width such that I don't need the vertical scrollbar to
see the full contents of the page? In other words, I need the
document's height.

Furthermore, I need to figure out how to do this in IE6 w/o switching
to strict mode (so, the default IE6 mode = quirks).

Chad
Sep 29 '06 #2

I'd be document.body.scrollHeight on geckos/IE, although you may want
to also take a look at overflow controlling by means of 'overflow'
property in CSS.
Danny
Sep 29 '06 #3
That unfortunately gives me the window width/height unless we doctype
to strict mode. I want to know the document width/height.

Chad
ag******@gmail.com wrote:
This may help...
var windowWidth;
var windowHeight;

if(window.addEventListener) {
windowWidth = window.innerWidth;
windowHeight = window.innerHeight;
}
else {
windowWidth = document.documentElement.clientWidth ||
document.body.clientWidth;
windowHeight = document.documentElement.clientHeight ||
document.body.clientHeight;
}

The top part is for web browsers and the bottom is for Intranet
Explorer.

I use that all the time for my JavaScript window apps...

CWaldman wrote:
How can I retrieve the required height of a page to fit in my current
browser window's width such that I don't need the vertical scrollbar to
see the full contents of the page? In other words, I need the
document's height.

Furthermore, I need to figure out how to do this in IE6 w/o switching
to strict mode (so, the default IE6 mode = quirks).

Chad
Sep 29 '06 #4
That was exactly what I was looking for. Thank you.

One question: What did you mean by taking a look at the overflow
property? What should I be looking for?
Danny wrote:
I'd be document.body.scrollHeight on geckos/IE, although you may want
to also take a look at overflow controlling by means of 'overflow'
property in CSS.
Danny
Oct 5 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Roar | last post by:
Hi! I have got 1 access 2000 DB, one simple search form, and 3 .asp pages (one for deleting a record, one for inserting a record and one for listing searchresults). Deleting records works fine,...
3
by: Rick | last post by:
I have an interesting problem when I run the following code in Netscape (7.02) vs. IE. This page works great in IE and all my controls bring up the validation summary dialog box if the required...
7
by: Leszek | last post by:
Hello, I need to set dynamically height and width attributes of an image control on a WebForm. I know how to read the whole image from the hard-drive and use its height and width properties. I...
1
by: Jan Van Steenbergen | last post by:
Hi all i'm having a little problem I have a aspx file with a iFrame defined The iframe is loaded with a html webeditor After editing data in the webeditor textbox, i want t get the data to a...
3
by: Paul W | last post by:
I have a ListBox Webcontrol with an OnSelectedIndexChanged event (and AutoPostBack=true). If I disable EnableViewState for this control, when I change the listbox index, the form does a postback...
13
by: Neo Geshel | last post by:
I have examined about 80+ different upload scripts on the 'net, both in VB and C#, and none seem to do what I need them to do. Perhaps someone here can point me somewhere that Google hasn't...
2
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can...
11
by: Patricio | last post by:
Hello all I open a PopUp that receives two variables (values). This PopUp must return a value as well. How can I retrieve this value? Thanks a lot.
2
by: phpachu | last post by:
Hi, I hav created a group of textboxes using a loop and its names are unique and names are assigned using variable ( like <input type=text name=$name1>). Then How can i retrieve the values in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.