Pawel wrote:
Is there any way I can dynamically (taking advantage of JavaScript) change
the properties for classes defined in CSS styles??
Let say there's a CSS class ".regtex" and it forces the browser to display
all elements of that class in red. Now I want to change this class so all
elements belonging to this class are displayed in blue, however I don't
want to change every single element, I just want to change the class'
properties. Is it possible??
One can access a collection of the style rules within a style sheet with
"cssRules" in order to alter any of its properties. Say your stylesheet
looked like this:
<style type="text/css">
a {color:green;}
..regtex {color:red;}
</style>
Then one can alter anchors to orange with:
document.styles heets[0].cssRules[0].style.color. = "orange"
And one can alter regtex classed elements to blue with:
document.styles heets[0].cssRules[1].style.color. = "blue"
You may also wish to look into "selectorTe xt" which is a string
containing the value of the selector, where in your case, selectorText
will contain ".regtex".
Another way is to call another class which will override previous
declarations. Here is an example which changes classes onmouseover:
http://www.home.golden.net/~richterf...4_Opera_1.html
Disregard the fixed box which describes an Opera redraw bug.
--
Gus