I don't think there's anyway to directly reference what's in a style declaration, only indirectly through an html element (as you found). However, you could temporarily create an element, assign the class of interest to it, and work with that. Of course, you probably want to 'learn' what classes are defined so you know what to assign to the temp element, which gets you nowhere because there's no way to read the style information (that I know of).
On Nov 26, 7:40 pm, Craig <[EMAIL PROTECTED]> wrote: > Hi, does anyone know if it's possible to extract a style attribute > from a style (and not an element)? > For instance: > <style> > .myclass { background-color:white; } > </style> > > I have some legacy javascript that takes colors as parameters to > functions and i'd like to be able to define those in a style sheet and > then 'extract' the colors from that. > > I can only get it to work if I do something like this: > <div class="myclass" /> > ... > var color = $(".myclass").css("background-color"); > > any ideas? > Craig.