Possible Duplicate:
Changing a CSS rule-set from Javascript
I was wondering if there is any possibility to modify Css stylesheet declarations without going for inline styling.
Here is a quick example :
<style>
.box {color:green;}
.box:hover {color:blue;}
</style>
<div class="box">TEXT</div>
That gives a blue written box that turns green written on hover.
If I give inline styling for the color, the hover behavior will be lost :
<div class="box" style="color:red;">TEXT</box>
That gives a red written box, no matter what.
So my question is, how can one access and modify the css declaration object rather than overwriting styles with inline ones.
Thanks,