HighDots Forums  

Getting size of window?

Javascript JavaScript language (comp.lang.javascript)


Discuss Getting size of window? in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Locke
 
Posts: n/a

Default Getting size of window? - 06-03-2008 , 10:29 AM






Hi,

What is the correct way to get the dimensions of the displayable window?
I.e. I don't want the border or the toolbar to be included in the height
or width.

I want to request an image from a php page by passing arguments for
height and width so that will be rendered to fit exactly in the window.

Thanks for any help.


Reply With Quote
  #2  
Old   
Bart Van der Donck
 
Posts: n/a

Default Re: Getting size of window? - 06-03-2008 , 10:37 AM






Locke wrote:

Quote:
What is the correct way to get the dimensions of the displayable window?
I.e. I don't want the border or the toolbar to be included in the height
or width.

I want to request an image from a php page by passing arguments for
height and width so that will be rendered to fit exactly in the window.

Thanks for any help.
http://www.jibbering.com/faq/#FAQ4_9

--
Bart


Reply With Quote
  #3  
Old   
Locke
 
Posts: n/a

Default Re: Getting size of window? - 06-03-2008 , 02:05 PM



Thanks, but none of those methods worked for me in IE 6.

The DOM method worked great in firefox and on my cell phone.

document.documentElement.clientHeight in firefox returns the height that
the content spans, not the height of the window

I need a solution that will work across all common browsers and
hopefully most cell phones. I assume at the moment this is not possible?

Thanks



Reply With Quote
  #4  
Old   
Lee
 
Posts: n/a

Default Re: Getting size of window? - 06-03-2008 , 02:52 PM



On Jun 3, 2:05*pm, Locke <jlo... (AT) www (DOT) com> wrote:
Quote:
*http://www.jibbering.com/faq/#FAQ4_9

Thanks, but none of those methods worked for me in IE 6.

The DOM method worked great in firefox and on my cell phone.

document.documentElement.clientHeight in firefox returns the height that
the content spans, not the height of the window

I need a solution that will work across all common browsers and
hopefully most cell phones. I assume at the moment this is not possible?

Thanks
document.body.clientHeight and document.body.clientWidth seems to work
fine on IE6, Firefox and Opera. Thats all I tested though.



Reply With Quote
  #5  
Old   
Locke
 
Posts: n/a

Default Re: Getting size of window? - 06-03-2008 , 03:36 PM



Quote:
In firefox, the error console gives the following message:

Error: document.body has no properties
Source File: file:///.../dim2.html
Line: 4

Never mind, its because I didn't have a <body> section, whoops!

Works now, thanks!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.