Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window height in ie6. body.clientHeight no help

Status
Not open for further replies.

FalconMaster

Programmer
Aug 8, 2002
4
US
Hi all,

I have been trying to make a window pop-up in the center of another window that I have.

I have seen other posts here, and have researched myself to find some methods of getting height and width of a window except under the following circumstance.

If I have a window that is not part of a frameset/iFrame , then the closest thing I can find to get the height is various properties of the document.body object such as clientHeight,scrollHeight, and/or offsetHeight. The problem is that these all give the height of the document and not the viewable area of the window itself, so if I have a large document, my pop up window ends up off the screen somewhere.

when the window is in a frameset, I can use the frameElement object of the window to find out its .height and .width perfectly. in fact, that is the information I want. But my application allows the user the possibility of opening multiple windows(required) for the same form, if they do not want it in a frame, and once the page is outside of a frameset, the frameElement object no longer exists.

Has anyone found any other way of getting the size of the viewable window of a page when it is not in a frameset?
 
FalconMaster,

in IE, clientHeight and clientWidth IS the h & w of the displayed area, not the entire document.

try it out:
<body onload=&quot;alert('h='+document.body.clientHeight+',w='+document.body.clientWidth)&quot;> =========================================================
if (!succeed) try();
-jeff
 
That is not working.

I went ahead and put in

alert(document.body.clientHeight);
alert(document.body.offsetHeight);
alert(document.body.scrollHeight);

and got the same results back for each one (4528).

I know that my screen resolution is only 768 high, so
4528 could not possibly be the correct height of the viewable portion of my script.

I am using ie 6.0.26 on Winnt 4 sp6

If I
 
hmm...perhaps your browser is corrupt. works fine for me with Win2k Server & IE 6.0, also with WinNT 4 SP6 & IE 5.5 SP2

is the test page very long? try it it a blank page, and resize the window & refresh.


=========================================================
if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top