View Full Version : finding the width of the IE
06-10-2003, 11:01 PM
I'm trying to find a property of either document or navigator or window that will tell me what the width of the window. I have already found two pretty handy one's for Netscape (innerHeight/Width) but IE seems to be more of a pain in the butt with these sort of things.
06-10-2003, 11:11 PM
06-10-2003, 11:26 PM
I get undefined when I try document.body.clientWidth in an alert box. ie alert(document.body.clientWidth). I know that screen.width is like 1024, because I have my resolution set to 1024x768. I'm not quite sure what the difference between width and availWidth is because I get 1024 each time. Hope this helps for response purposes.
06-10-2003, 11:38 PM
doesn't work if it is called before onLoad I think it is,
Note: I migth be wrong if I am I bet some1 will say so :)
screen.width shows the width of the screen.
screen.availWidth shows the availble width of screen.
if u put ur task bar to be aligned on the side of the sceen u will see the difference
06-10-2003, 11:43 PM
I actually had it running in my onLoad function... wierd. I put a line in my body tag:
I don't know why it wouldn't work inside the adjustWidth() function, which is actually where I need it. I guess I could make a dummy function that just calls the adjustWidth() one. I'll try that and report back.
06-10-2003, 11:47 PM
Thanks for your help Garadon, you pointed me in the right direction. I got it to work with a dummy function that just calls the function I actually want to call. I guess the onLoad event calls the set function before it sets some of the other variables. Thanks,
06-11-2003, 12:28 AM
if you're working in IE6's "Standards Compliant" mode - for example, using an XHTML Strict doctype without an XML declaration - then document.body.clientWidth no longer returns a value.
The equivalent for that situation is document.documentElement.offsetWidth
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.