Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window Resizing

Status
Not open for further replies.

Sarky78

Programmer
Oct 19, 2000
878
GB
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';
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top