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
    New Coder
    Join Date
    Aug 2009
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    checking/changing the status of a style

    How do I check the status of a style?

    I thought something like this would work, but no joy:
    Code:
    divTest = document.getElementById('link_container');
    if (document.divTest.style.display == "none") {
    }
    Last edited by niche; 12-09-2011 at 07:32 PM.

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    967
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Code:
    <p id = "link_container" style="display:none;">Link</p>
    
    <script type = "text/javascript">
    divTest = document.getElementById('link_container');
    if (divTest.style.display == "none") {
    	alert("hi")
    }
    		</script>

  • Users who have thanked DaveyErwin for this post:

    niche (12-11-2011)

  • #3
    New Coder
    Join Date
    Aug 2009
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts
    DaveyErwin, thanks for your help.


  •  

    Posting Permissions

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