RObray
August 2nd, 2004, 05:50 PM
I've got an html document that I want the size of a table to be determined by the height of the browser window. I've placed the following code right under the body tag just to test the acuracy. The width output seems to be correct but the height output is 0. I can't quite figure out why so if anyone knows a better way to do it I would appreciate knowing. Here is the code I'm inserting into my document:
if((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >=4)){
windowwidth = window.innerWidth;
windowheight = window.innerHeight;
}
else if((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >=4)){
windowwidth = document.body.clientWidth;
windowheight = document.body.clientHeight;
}else{
windowwidth = 800;
windowheight = 600;
}
document.write("Your browser window has a height of " + windowheight + "<br>");
document.write("Your browser window has a width of " + windowwidth + "<br>");
if((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >=4)){
windowwidth = window.innerWidth;
windowheight = window.innerHeight;
}
else if((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >=4)){
windowwidth = document.body.clientWidth;
windowheight = document.body.clientHeight;
}else{
windowwidth = 800;
windowheight = 600;
}
document.write("Your browser window has a height of " + windowheight + "<br>");
document.write("Your browser window has a width of " + windowwidth + "<br>");