Andrew Poulos wrote:
> Say I have some CSS, which is several hundred lines long, with the
> contents in this format:
>
> .foo {
> blah
> color:#000;
> blah
> }
> .bar {
> blah
> color:#FFF;
> }
>
> where the selectors and their opening braces, their closing braces, and
> declarations are each on their own lines (always), how can I replace a
> specific declaration (line) given a unique selector and a declaration
> property. For example, if I wanted the 'color' declaration property line
> in the 'bar' class changed.
If you have that CSS in a HTML style element or in an external
stylesheet linked in with the HTML link element then browsers like
Mozilla or Netscape or IE build a DOM with
document.styleSheets
and
document.styleSheets[i].cssRules
respectively
document.styleSheets[i].rules
You can search those rules for the selector and then access the
individual property declarations.
--
Martin Honnen
http://JavaScript.FAQTs.com/