You can access the stylesheet object using JavaScript. However, each browser
represents CSS rules differently. There is no cross-browser way to
access/manipulate the rules. I *had* to manipulate the stylesheet object in
Safari to avoid the a:hover over swf bug... but even Safari represented the
rules differently between versions (1.3.2 vs. 2.0.4).

It is certainly "death by a thousand cuts" to edit the stylesheet object. I
recommend adding another class and going that route.

Brian.

On 4/18/07, Scott Sauyet <[EMAIL PROTECTED]> wrote:


Klaus Hartl wrote:
> howard chen schrieb:
>>
>> sorry, a:hover is just an example, what i want is to style pseudo
>> class, such as a:visited, a:active etc....
>
> There are no properties in JavaScript that represent these pseudo
> classes, thus it cannot be done.

However, as long as what you want is not too dynamic and you can add CSS
rules to handle them, you can have

CSS:
     a.class1:visited { /* whatever */ }

JS:
     $("a").each(function() {
        $(this).addClass("class1");

        // do the rest
     )

to achieve the same effect.  I believe there are techniques to modify
the current stylesheets too, but they are difficult to do correctly
cross-browser.

Good luck,

  -- Scott


Reply via email to