Web Analytics Made Easy -
StatCounter Getting the width of the current window - CodingForum

Announcement

Collapse
No announcement yet.

Getting the width of the current window

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting the width of the current window

    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

  • #2
    Code:
    <script type="text/javascript">
    window.onload = function()
    {
     var iWidth = (document.all)?document.body.clientWidth:window.innerWidth;
    
     alert(iWidth);
    }
    </script>
    Zvona
    First Aid for
    Web Design

    Comment


    • #3
      Thanks.

      Comment

      Working...
      X