...

View Full Version : windowWidth undefined in IE



Jesper Møller
06-19-2006, 12:06 PM
Why do i get windowWidth undefined with this in IE
works fine in NN/FF

function WindowWidthandHeight() {
var windowHeight = 0;
var windowWidth = 0;
var centerLag = action[1];
if (typeof(window.innerHeight) == 'number') {
windowHeight = window.innerHeight;
windowWidth = window.innerWidth;
}
else {
if (document.documentElement && document.documentElement.clientHeight) {
windowHeight = document.documentElement.clientHeight;
windowWidth = document.documentElement.clientWidth;
}
else {
if (document.body && document.body.clientHeight) {
windowHeight = document.body.clientHeight;
windowWidth = document.bodyclientWidth;
}
}
alert (windowWidth);
alert (windowHeight);
}

vwphillips
06-19-2006, 01:08 PM
function zxcWWHS(){
var winww,zxcwh,zxcsl,zxcst,zxcwc;
if (window.innerHeight){
zxcCur='pointer';
zxcwh=window.innerHeight-20;
zxcww=window.innerWidth-20;
zxcsl=window.pageXOffset;
zxcst=window.pageYOffset;
}
else if (document.documentElement.clientHeight){
zxcCur='hand';
zxcwh=document.documentElement.clientHeight;
zxcww=document.documentElement.clientWidth;
zxcsl=document.documentElement.scrollLeft;
zxcst=document.documentElement.scrollTop;
}
else if (document.body.clientHeight){
zxcwh=document.body.clientHeight;
zxcww=document.body.clientWidth;
zxcsl=document.body.scrollLeft;
zxcst=document.body.scrollTop;
}
zxcwc=Math.round(zxcww/2);
return [zxcww,zxcwh,zxcsl,zxcst];
}

function zxcBdyWH(){
var x,y;
var test1 = document.body.scrollHeight;
var test2 = document.body.offsetHeight
if (test1 > test2) // all but Explorer Mac
{
x = document.body.scrollWidth;
y = document.body.scrollHeight;
}
else // Explorer Mac;
//would also work in Explorer 6 Strict, Mozilla and Safari
{
x = document.body.offsetWidth;
y = document.body.offsetHeight;
}
}

Jesper Møller
06-19-2006, 01:49 PM
Im nut shuer What you are trying to say with that ??

scrollTop & scrollLeft ???

My question was simply why i get the windowWidth undefined in IE

vwphillips
06-19-2006, 07:31 PM
put what you dont want in a safe place



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum