You could access the CSS rules via document.stylesheets[x].cssRules [x].style.color, for example, but cross-browser support is not very good:
http://www.quirksmode.org/dom/w3c_css.html - ricardo On Nov 26, 10: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.