Tuesday, 27 July 2010

width and height of the client window

Use this snippet to obtain the width and height of the visitor's client window. This is a much better method than getting the resolution as this is the actual size of the window displaying the Web page.

function getClientWidth() {
return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function getClientHeight() {
return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}

click on the following link to download the JS file

http://www.megaupload.com/?d=7JP0RF1Y

No comments:

Post a Comment