Topic awaiting preservation: Accessing CSS pseudo-classes through the DOM (Page 1 of 1) |
|
---|---|
Maniac (V) Mad Scientist From: :morF |
posted 11-08-2005 11:22
Is this actually possible? In CSS you can use the :before pseudo-class to prepend your own bullets to an unordered list, but if, say, onClick() I wanted to change that icon, can I do that through the DOM? |
Bipolar (III) Inmate From: Umeå, Sweden |
posted 11-08-2005 16:04
I'm rusty from staying out of the web development business for half a year, so my memory might fail me. But as I recall, there is no definite way. You can't do it on a per-element basis (Syntax of CSS rules in HTML's "style" attribute that purposed to change this never got past WD stage), you need to add to - or change - the stylesheets for the document. |
Paranoid (IV) Inmate From: A graveyard of dreams |
posted 11-08-2005 16:18
I looked at that a couple of months ago, and didn't find anyway to do it with Javascript. What I ended up doing was using Javascript to change the class of the 'li' instead, which in the end has the same effect even though it might not be as nice |
Paranoid (IV) Inmate From: France |
posted 11-08-2005 19:33
Skaarj: Actually the easiest way is to, as Veneficuz said, to play with the className of the LI. But, if you *really* want to touch the :before pseudo-element, you can append/overwrite your own CSS rules using the Stylesheets object. |
Paranoid (IV) Inmate From: France |
posted 11-11-2005 16:48
Just in case, here is a tutorial to edit the Stylesheets in JavaScript |