using JS to change multiple same-name IDs
so check it, i have this game server query thing im writing in PHP for a game called starsiege tribes.. ive spent so much time today doing the PHP that im getting a brainfreeze on how to do the following:
in a given row, my table will always have 10 columns. 9 will have a style that i want to change. so i know i will need to assign the 9 the same ID. whenever there is a mouseover event on any one of the 9, i want the other 8 to all have their text color change to white. on mouse out, it goes back to what it was before. this gives me the effect of a highlight.
how do i write this in JS? i know its simple, but right now ive OD'd on PHP and i just cant pull it out, or correctly phrase the question to the search bar. heck, even linking a previously answered question on this topic will help!
1) IDs should be unique. You could use a class instead.
Class and ID Selectors
When should I use a class and when should I use an ID?
The Meaning of Semantics Take II: Naming Conventions for Class and ID in CSS
Use class with semantics in mind
Multiple elements may belong to the same class and an element may belong to multiple classes. The X/HTML class attribute's value may be a space separated list of classes.
2) Why don't you set the background-color on the 10th column and just change the color of the <tr> for the other columns?
semantics. whatever. fine, ill use a class instead.
how do i browse through all the class elements of name x on a page? whats the for loop look like?
thanks! i was confident someone had this info since it was easy!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)