PDA

View Full Version : Window sizes


Simrey
10-09-2002, 12:09 AM
Does anybody know of a simple way (or failing that, I'll settle for a complicated way) to discover the dimensions of the browser window without opening a new one or resizingTo()? NS4 thoughtfully provides a useful range of tools such as window.innerHeight, but -- astonishingly -- IE appears almost deliberately to ignore it -- as, apparently, does NS6 though I've no experience with that yet. I find that document.body.offsetHeight does the trick -- on my Mac and on some PCs, but not on my office PC, where (logically) it just returns the southern limit of the actual content, which is all of 50 pixels. I'm doing a routine of images floating about, bouncing off each other and off the sides of the window. At the moment I have to resizeTo which is ok but not really elegant, and not guaranteed to have them bouncing precisely off the right and bottom edges, especially if the user subsequently resizes the window...

x_goose_x
10-09-2002, 02:22 AM
This any help?:

http://www.xs4all.nl/~ppk/js/doctypes.html

Simrey
10-09-2002, 07:55 AM
That looks like exactly the information I'm after. Thank you. This is most exciting! I shall try it in my code and let you know how I go...

Mr J
10-09-2002, 03:08 PM
Try these

document.body.clientWidth

document.body.clientHeight

Simrey
10-10-2002, 09:00 PM
Yup: document.body.clientHeight etc does the trick, and I was also introduced to document.documentElement on the link provided by x-goose-x, so thankyou both for your help.