3 replies [Last post]
eaglegfx
Offline
newbie
Last seen: 14 years 46 weeks ago
Joined: 2006-01-10
Posts: 10
Points: 0

I know how to make a rollover style change in CSS by using a:hover.

However, is there any way to make multiple rollover style changes?

For example, I have several elements with the same class name in several different areas on the page. When I roll over one of those elements I want ALL of the elements with the same class name to change its background colour.

Maybe this would have to be done with Javascript...but any help would be greatly appreciated!

xaphalanx
xaphalanx's picture
Offline
Enthusiast
Last seen: 15 years 25 weeks ago
Joined: 2005-06-06
Posts: 64
Points: 0

[SOLVED] Multiple Rollovers?

Whoa! If you figure out how to do it please post the code. I don't know how to do it but if I understand correctly I'd be looking at getElementsById(); or something like that to roll them over -- JavaScript.

eaglegfx
Offline
newbie
Last seen: 14 years 46 weeks ago
Joined: 2006-01-10
Posts: 10
Points: 0

[SOLVED] Multiple Rollovers?

I have also tried with getElementById() and all that does is return the first occurence of the ID. Can you declare more than one ID per getElementById()?

Or, if I would change my ids so that they are "myid.1", "myid.2", etc. would I be able to do some kind of matching such as getElementById("myid.*")?

The problem is that I have several of these multiple IDs and they are all generated by grabbing data from a database. Otherwise, I could just write up a javascript function and code it manually...

Thanks for any help!

eaglegfx
Offline
newbie
Last seen: 14 years 46 weeks ago
Joined: 2006-01-10
Posts: 10
Points: 0

[SOLVED] Multiple Rollovers?

SOLVED! And I can't be more thrilled!

Here is a link to some sample code for any who are needing help with a similar issue:

http://www.cookiecrook.com/webx/getElementByClass.htm