[thelist] A JavaScript question

Tom Dell'Aringa pixelmech at yahoo.com
Fri Sep 19 17:01:27 CDT 2003


--- john at johnallsopp.co.uk wrote:

> and so this kinda thing: <a href="" class="menuText" onMouseOver=
> "document.getElementById('menu11').style.background-color =
> '#FFFFFF';">
> Editorial</a></td> should change the table cell background to white
> when I roll over the link.

John, 

Javascript handles property names differently, and it doesn't
like/use the '-'. What you need is this:

onMouseOver="document.getElementById('menu11').style.backgroundColor
= '#FFFFFF';"

note the property name is "backgroundColor". All the properties are
accessed with JS this way, remove the dash and intercap the word.

HTH

Tom


More information about the thelist mailing list