...

View Full Version : Getting the width of the current window



Moo
07-03-2002, 11:24 AM
Does anyone know how to find the width of the browser window that the page is in. i.e., when a page is loaded I want to intialise a variable with the value of the width of the windowit's in.

Thanks

Zvona
07-03-2002, 11:39 AM
<script type="text/javascript">
window.onload = function()
{
var iWidth = (document.all)?document.body.clientWidth:window.innerWidth;

alert(iWidth);
}
</script>

Moo
07-03-2002, 11:50 AM
Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum