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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Location
    Taplow, Berkshire
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    style.overflow returns null?

    I know there is probably going to be an embarrassingly simple answer to my issue (like I am pointing to the wrong place in the DOM) but here goes. Why is the value of overflow not being returned by the below script?

    Code:
    <style type="text/css">
    
    div.fbOverflow_Scroll { position:absolute; top:20px; left:20px; z-index:27; 
        overflow:scroll; overflow-x:hidden; height:30px; width:100px; 
        background-color:#FFB60D; border:1px Solid #000000; }
        
    </style></head><body><form method='post' enctype='multipart/form-data' id='myForm' name='myForm'>
    
    <!-- **** lab(Box10pt, fbOverflow_Scroll, , Extra=) -->
    <div class='fbOverflow_Scroll' id='fbOverflow_Scroll' position=relative >
        This is stuff inside of a little scrolling area of the form</div>
    
    <script language="JavaScript">
        alert(document.getElementById('fbOverflow_Scroll').style.overflow);
    </script>
    
    </form>

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Using style will only return the inline style properties. You need to use currentStyle or getComputedStyle. Refer to this link for more info.


  •  

    Posting Permissions

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