Results 1 to 4 of 4

Thread: Make text of (some) labels blue when clicked on

Threaded View

  1. #1
    Join Date
    Jan 2003

    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:

    <script type="text/javascript">
    function blueme() {
    <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>
    <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
    Last edited by W8 4me; 02-28-2012 at 08:02 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center