How do I read or set the current window's size?
Netscape and IE use different properties for reading the size of a window. You set the size of a current window in Netscape by setting the innerHeight and innerWidth or outerHeight and outerWidth properties. Inner refers to the window's content area (where your HTML sits) and Outer refers to the windows borders (the size of the whole browser window).
To read the values in Netscape :
oH = window.outerHeight;
oW = window.outerWidth;
alert("Height: " + oH + "px Width: " + oW + "px");
To set the current window's dimensions in Netscape
window.outerHeight = 500;
window.outerWidth = 400;
You can place the script anywhere in you HTML document. The closer to the top, the quicker the script will be read and executed. Use the innerWidth and innerHeight to control the size of the content area.
The method used to resize the Window in Internet Explorer is as such:
where 500 is the width and 400 is the height. To read the size of the window's content area in Internet Explorer you must place this script after the <body> tag :
iW = document.body.clientWidth;
iH = document.body.clientHeight;
alert("Inner Width: " + iW + "px Inner Height:" + iH);
Internet Explorer also has executes the following methods
where x and y are the absolute pixel positions. That is, you use numbers in place of x and y.