How to get browser screen settings and apply to page controls??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EricBlair
    New Member
    • Mar 2007
    • 15

    How to get browser screen settings and apply to page controls??

    Hello,

    New to Javascript and was wondering if anyone can show me the following...

    I want to get the height of the browser's viewing area and then set a page control's height to that value.

    For example, I have a asp:Panel that has a certain default height in px units...I'd like to override that on page load or other event and apply the actual height of the browser's viewing area to it.

    Thanks in advance!!
    --eb
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    hi ...

    to retrieve the height you may use:

    [CODE=javascript]// not IE-browsers
    var height = window.innerHei ght;

    // IE
    var height_ie = document.body.c lientHeight;[/CODE]
    or just set the height of your desired control to 100%

    kind regards

    Comment

    • EricBlair
      New Member
      • Mar 2007
      • 15

      #3
      Originally posted by gits
      hi ...

      to retrieve the height you may use:

      [CODE=javascript]// not IE-browsers
      var height = window.innerHei ght;

      // IE
      var height_ie = document.body.c lientHeight;[/CODE]
      or just set the height of your desired control to 100%

      kind regards
      Thanks for your reply! I can't use 100% because this is for setting an ajax control that only takes px units. So I need the browser space as provided by javascript, which I hope is returned in px units. Is it?

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        hmmm ... you will get an absolute px-value and in case you set it then just concat the 'px' to it ...

        kind regards

        Comment

        Working...