I need to find out how to determine the size of an open window so that I can set the size of a div. I want the div to be full screen, but without any scroll bars. I have tried using screen.availHeight and screen.availWidth, but they return the same values no matter what the size of the window is. I thought there was a property that returned this, but I can't seem to find it. I need a cross-browser solution (mainly IE5.5+ and NS6+).
// Window dimensions:
if (window.innerWidth)
theWidth=window.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth)
theWidth=document.documentElement.clientWidth;
else if (document.body)
theWidth=document.body.clientWidth;
if (window.innerHeight)
theHeight=window.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
theHeight=document.documentElement.clientHeight;
else if (document.body)
theHeight=document.body.clientHeight;
// Window dimensions:
if (window.innerWidth)
theWidth=window.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth)
theWidth=document.documentElement.clientWidth;
else if (document.body)
theWidth=document.body.clientWidth;
if (window.innerHeight)
theHeight=window.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
theHeight=document.documentElement.clientHeight;
else if (document.body)
theHeight=document.body.clientHeight;
Hi, i need something like that.
It's been a long time ago since you post the code. What can I use for FF2 and IE6+??
Bookmarks