Link to home
Start Free TrialLog in
Avatar of gileze33
gileze33

asked on

Get Width

Can anybody tell me how to get the width of a page?

I am trying to layout my page using DIV's, and I have a DIV setup fine on the right of the page, and one on the left, but I want to make the DIV on the left to only be as wide as the page minus the width of the DIV on the right.
i.e. so there is like this:
_______________________________
|left div                           |  |right div|
|                                    |  |            |
|                                    |  |            |
|                                    |  |            |
|                                    |  |            |
|____________________ |_|_______|

Gileze33
Avatar of Eternal_Student
Eternal_Student
Flag of United Kingdom of Great Britain and Northern Ireland image

window.innerWidth

and for IE
document.body.offsetWidth
Here is a more detailed way for width and height:

var x,y;
if (self.innerHeight) // all except Explorer
{
      x = self.innerWidth;
      y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
      // Explorer 6 Strict Mode
{
      x = document.documentElement.clientWidth;
      y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
      x = document.body.clientWidth;
      y = document.body.clientHeight;
}
ASKER CERTIFIED SOLUTION
Avatar of Arijit S
Arijit S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial