[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? 
>there
>does not seem to be anything like that in the spec
>http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/ecma-script-binding.html
>
>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 
>IE6
>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
http://www.xs4all.nl/~ppk/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
New: Browser Wars II: The Saga Continues
http://evolt.org/article/rdf/25/60181/
------------------------------------------------------------------

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail



More information about the thelist mailing list