I am trying to write a bit of javascript that will resize a DHTML layer, based on the size of the browser. So if the browser window is 1024x768, and is then resized to 800x600 i want the code to check the size of the window and resize the layer dynamically.
I have the following code, that centers the object, in the window, but when i resize the window the object does not re-center the object. Is there any way of detecting the size of the window. I can detect the size of the screen, which is not of great use, unless the user is running the browser full screen.
function position()
{
var tablesize = 560;
if (! document.layers)
{
alert(screen.width);
document.all["divCont"].style.visibility='hidden';
var leftpos = (screen.width-tablesize)/2;
document.all["divCont"].style.left=leftpos;
document.all["divCont"].style.visibility='visible';
}
}
I have the following code, that centers the object, in the window, but when i resize the window the object does not re-center the object. Is there any way of detecting the size of the window. I can detect the size of the screen, which is not of great use, unless the user is running the browser full screen.
function position()
{
var tablesize = 560;
if (! document.layers)
{
alert(screen.width);
document.all["divCont"].style.visibility='hidden';
var leftpos = (screen.width-tablesize)/2;
document.all["divCont"].style.left=leftpos;
document.all["divCont"].style.visibility='visible';
}
}