How do I change an HTML object"s CSS style via javascript?

How do I change an HTML object"s CSS style via javascript?

am 17.06.2007 01:02:31 von screenaccount

Hello. The snippet of JS, HTML, and CSS below displays a left
navigation menu. Each item in the menu is associated with a particular
DIV section in the page. Clicking that item will show that section and
hide the others, letting the users see different content on the same
page.

That all works OK. However, I can't figure out how to get whatever
menu item the user clicks to remain selected. I created a CSS snippet
("selected") to format selected menu items, I just can't figure out
how to toggle the selected state on and off after click events.

Thanks in advance -- any help is appreciated.






content

etc.




/* CSS snippets: */
#menu
{ various settings for the menu }

#menu li a
{ various settings for the menu items }

#menu li:hover a
{ cursor: pointer; other settings for mouseovers }

#menu li a#selected
{ various settings for selected menu items }