Make text of (some) labels blue when clicked on
Hi all,
I'm trying to find the best way to change (some) of my label's text to the colour blue when the associated radio button is checked.
However, when another radio button is checked within the same category, the other label's text (within that same category) should go back to the page's standard text colour.
I am restricted because I need to make this work in IE7, therefore the CSS :focus selector doesn't work.
So far I've tried this (the two categories are: Type of vehicle, Type of fuel), but it's not working:
Code:
<script type="text/javascript">
function blueme() {
this.style.color='blue';
}
</script>
...
<label>Type of vehicle:</label>
<label onfocus="blueme()"><input type="radio" name="vehicle" value="Car" /> Car</label>
<label onfocus="blueme()"><input type="radio" name="vehicle" value="Motorcycle" /> Motorcycle</label>
<label onfocus="blueme()"><input type="radio" name="vehicle" value="Bicycle" /> Bicycle</label>
<p></p>
<label>Type of fuel:</label>
<label onfocus="blueme()"><input type="radio" name="fuel" value="Petrol" /> Petrol</label>
<label onfocus="blueme()"><input type="radio" name="fuel" value="Diesel" /> Diesel</label>
<label onfocus="blueme()"><input type="radio" name="fuel" value="Cabbage" /> Cabbage</label>
thanks guys