Click to See Complete Forum and Search --> : window size


danic83
08-20-2003, 02:04 AM
I need to now the width (in pixel) of the page. how can I retrieve it? thank you

AdamGundry
08-20-2003, 02:27 AM
You might be able to use on of these:
screen.width (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/screen.html#1193281) (size of the screen)
window.innerWidth (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1202446) (size of the window's content area)

Adam

danic83
08-20-2003, 02:52 AM
Originally posted by AdamGundry
You might be able to use on of these:
screen.width (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/screen.html#1193281) (size of the screen)
window.innerWidth (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1202446) (size of the window's content area)

Adam

thank you Adam. I tried it.
I tried to write a message with the window width:

window.alert("Window width="+window.innerWidth);

the report is:

Window width= undefined

I don't really know why! Help..

Daniel

AdamGundry
08-20-2003, 03:56 AM
Sorry, my mistake - window.innerWidth is only available in Mozilla-based browsers. You can use document.body.clientWidth instead, as long as the <body> tag has rendered.

Adam

danic83
08-20-2003, 04:38 AM
Originally posted by AdamGundry
Sorry, my mistake - window.innerWidth is only available in Mozilla-based browsers. You can use document.body.clientWidth instead, as long as the <body> tag has rendered.

Adam

Now it's OK!
THANK YOU VERY MUCH

have a nice day