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 4 of 4
  1. #1
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Finding Div Height when not explicitly set

    i need to find a div tags height property, however it is not set in the source.

    like
    Code:
    <div id="someDiv">some text</div>
    document.getElementById('someDiv').style.height doens't work.
    Last edited by rlemon; 04-19-2005 at 12:22 AM.

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    is there not like a pixelOffset?

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Posts
    400
    Thanks
    0
    Thanked 0 Times in 0 Posts
    offsetHeight

  • #4
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    function getStyle(el,styleProp)
    {   var x = document.getElementById(el);
         if (window.getComputedStyle)
        {   var y = window.getComputedStyle(x,null).getPropertyValue(styleProp);
        }   //for FF
        else
        {   var y = x['currentStyle'][styleProp];
        }   //for IE
        alert(y);
    }
    FireFox will return the height in pixels but
    unless the property is assigned IE only returns auto...


  •  

    Posting Permissions

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