Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Moo
    Moo is offline
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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
    Regular Coder
    Join Date
    May 2002
    Location
    Helsinki, Finland
    Posts
    231
    Thanks
    0
    Thanked 1 Time in 1 Post
    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

  • #3
    Moo
    Moo is offline
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •