set style with :hover javascript

I understand that the following method is great for setting CSS styles because of browser compatibility.

element.style.cssText = "color:red;";

What I can't do is use cssText to apply styles on the :hover and :focus CSS events.
What do I do instead of this?

element.style.cssText = ":focus{color:red;}";

P.S. Don't mention using javascript events such as onmouseover instead of the CSS :hover ( It doesn't fit my situation.)

8
задан Web_Designer 15 May 2011 в 05:54
поделиться