[thelist] set a:hover props from JS

Peter-Paul Koch gassinaumasis at hotmail.com
Thu Aug 28 14:39:34 CDT 2003

>Anyone know if and how one can set the a:hover Style properties from JS? 
>does not seem to be anything like that in the spec
>I want to do
>document.getElementById('foo').style.backgroundColorHover = 'red';
>but is there a property for that?

As far as I know there isn't any. Pity, but unsolvable.

>annoyingly, when I set the backgroundColor for a <A> element, it seems to
>override the a:hover background which was set in the CSS. This happens on 
>and Moz. So I am looking for a workaround.

That's logical. You set style.backgroundColor and thus the *inline* styles 
of the element, which overrule the embedded or linked a:hover styles in the 
style sheet

ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
New: Browser Wars II: The Saga Continues

Tired of spam? Get advanced junk mail protection with MSN 8. 

More information about the thelist mailing list