Click to See Complete Forum and Search --> : How to get browser width when resized


ck969
11-29-2002, 10:38 AM
When I resize my browser, on the <body> tag, how could I call a function and return the current browser width ?

gil davis
11-29-2002, 12:20 PM
<script>
window.onresize = myResize;
function myResize() {
if (document.all)
{alert(document.body.clientWidth);}
else
{alert(window.innerWidth);}
}
</script>


I'm not sure why you think the <body> has to have the script.