SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot spybreak's Avatar
    Join Date
    Apr 2003
    Location
    Germany
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Extracting a property from a CSS class using JavaScript

    I have following css code in a html file:

    <style>
    .myClass { color:red; }
    </style>

    How can I extract the value of the property "color" from the class "myClass"?

    Pseudo-code (which of course doesn't work), so you get the idea:

    <input type="button" onclick"alert('The CSS color is '+document.style.myClass.color)">


    Thanks btw!

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    This should get you on your way .

  3. #3
    SitePoint Zealot spybreak's Avatar
    Join Date
    Apr 2003
    Location
    Germany
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks

    lol, you're looking so, I don't know, evil maybe? on your photo

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by spybreak
    thanks

    lol, you're looking so, I don't know, evil maybe? on your photo
    My eyes were half-shut. I think the sun was in my face in that pic; the Holiday background is photoshopped in .


Bookmarks

Posting Permissions

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