[thelist] A JavaScript question

john at johnallsopp.co.uk john at johnallsopp.co.uk
Fri Sep 19 15:07:49 CDT 2003

Hi y'all

All I know about Javascript I learned from the SAMS 24 hours book. It
seems to say that you can get hold of any web page object and change its
stylesheet properties.

What you do is, give your element an id like so <td class="menuTable"

and then you can refer to it like so getElementById('menu11')

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.

Of course, it doesn't work. Actually it doesn't throw an error either. Now
I've come a cropper with getElementById before and the eminent person who
advised me then gave the impression that it's simply not used (maybe it's
out of date or doesn't work in a major browser).

Which leads me to ask. Which concepts am I missing in order to think that
this will work, and then to not understand why? I mean, a quick fix would
be great, but I also want to know what it is that I don't understand. I do
have lots of JavaScript links to explore, but I don't know which direction
to head in.

All help appreciated as always.


More information about the thelist mailing list