I have a table generated through a struts2 iterator (so variable length and content) which roughly looks like this but with more columns:
<table>
<tr class="odd" machineId="1" parameterId="1"><td></td></tr>
<tr class="even" machineId="1" parameterId="2"><td></td></tr>
<tr class="odd" machineId="1" parameterId="3"><td></td></tr>
<tr class="odd" machineId="2" parameterId="4"><td></td></tr>
<tr class="even" machineId="2" parameterId="5"><td></td></tr>
<tr class="odd" machineId="3" parameterId="10"><td></td></tr>
<tr class="noParameters" machineId="4"><td></td></tr>
<tr class="odd" machineId="6" parameterId="8"><td></td></tr>
<tr class="odd" machineId="7" parameterId="9"><td></td></tr>
</table>
Essentially, what I want is the following:
- Any row which is hovered over needs to have a certain color.
- Any other rows with the same machineId value as the one being hovered over need to have a different color.
- All other rows need to have their default color.
I really would like to be able to do this using default CSS (so no SASS), compatible with all major browsers including IE11 and if at all possible (but not completely necessary) IE9.
The existing page I'm migrating uses Javascript for this with Dojo 1.3 (migrating to Dojo 1.9 right now) to assign custom highlight classes on mouseover, but I'm hoping I can use pure CSS for this. If necessary, I can convert the Dojo 1.3 code to Dojo 1.9, but I'd rather that be my backup plan.
Can I achieve what I'm looking for with pure CSS?