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
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Retrieve all styles from element

    Hi,

    When I have a div like:

    <div id="mydiv">Hello world</div>

    With (in a separate css-file) styles like:

    #mydiv
    {
    width:100px;
    border:1px solid red;
    }

    I like to have an alert showing all styles of this div.

    And when it's possible also styles I did not mentioned in mydiv, like height etc, the basic settings

    Tried something like:

    function f1(){
    alert(document.getElementById('mydiv').style.border-color);
    }

    Any idea? thanks,
    Jerome

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You need to read from the currentStyle object in IE

    See this page for more info
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Good explenation!

    Thanks Beetle,
    Jerome


  •  

    Posting Permissions

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