You can, but it’s rather cumbersome. The best reference on how to do it is the following article: Totally Pwn CSS with Javascript (web archive link).
I managed to get it to work with Firefox and IE – I couldn’t in Chrome, though it appears that it supports the DOM methods.ricosrealm reports that it works in Chrome, too.