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
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
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.c lientHeigh t)
// Explorer 6 Strict Mode
{
x = document.documentElement.c lientWidth ;
y = document.documentElement.c lientHeigh t;
}
else if (document.body) // other Explorers
{
x = document.body.clientWidth;
y = document.body.clientHeight ;
}
var x,y;
if (self.innerHeight) // all except Explorer
{
x = self.innerWidth;
y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.c
// Explorer 6 Strict Mode
{
x = document.documentElement.c
y = document.documentElement.c
}
else if (document.body) // other Explorers
{
x = document.body.clientWidth;
y = document.body.clientHeight
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and for IE
document.body.offsetWidth