toggle color depending on whether a radio button is selected or deselected

Discussion in 'Javascript' started by newfie912, Feb 15, 2007.

  1. newfie912

    newfie912 Guest

    I have an online application used for grading students. On one of the
    pages, I have a table with two rows and each row has 16 cells. The
    upper row contains the letter grade (A, A-, B+, B, etc) and the lower
    row has a 16 radio buttons for selecting the appropriate grade. This
    all writes to a SQL server back-end and has been working fine for
    several semesters. Some faculty members have complained that it is
    hard to read and see which have been graded so far and which still
    need to be graded. It has been suggested that we change the
    background color of the selected letter grade to a different color. I
    have had some sucess with this, but haven't figured out how to
    "toggle" the color on and off based on the state of the radio button.
    I can get it to change color when selected, but the color persists if
    another radio button is selected. Does anyone have some sample code
    for this?

    thanks,

    don
    newfie912, Feb 15, 2007
    #1
    1. Advertising

  2. newfie912

    Evertjan. Guest

    newfie912 wrote on 15 feb 2007 in comp.lang.javascript:

    > I have an online application used for grading students. On one of the
    > pages, I have a table with two rows and each row has 16 cells. The
    > upper row contains the letter grade (A, A-, B+, B, etc) and the lower
    > row has a 16 radio buttons for selecting the appropriate grade. This
    > all writes to a SQL server back-end and has been working fine for
    > several semesters. Some faculty members have complained that it is
    > hard to read and see which have been graded so far and which still
    > need to be graded. It has been suggested that we change the
    > background color of the selected letter grade to a different color. I
    > have had some sucess with this, but haven't figured out how to
    > "toggle" the color on and off based on the state of the radio button.
    > I can get it to change color when selected, but the color persists if
    > another radio button is selected. Does anyone have some sample code
    > for this?


    No, we don't yust supply sample codes, because we are not going to do your
    work and we [at least I] think that helping should also be educational.

    Try to give all radio buttns an onclick calling the same function each with
    the argument "this".

    The function clears the colour of all buttons, and then the colour of the
    active button, that is the one that is clicked is set all using
    style.backgroundColor.

    Try to make a script and come back with your problems showing the script.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Feb 15, 2007
    #2
    1. Advertising

  3. newfie912

    ASM Guest

    Re: toggle color depending on whether a radio button is selectedor deselected

    newfie912 a écrit :
    > I have an online application used for grading students. On one of the
    > pages, I have a table with two rows and each row has 16 cells. The
    > upper row contains the letter grade (A, A-, B+, B, etc) and the lower
    > row has a 16 radio buttons for selecting the appropriate grade. This
    > all writes to a SQL server back-end and has been working fine for
    > several semesters.


    You should have to use the evalutaion system based on points "Lomer"
    ....
    only 4 grades
    (something is known or not, what does mean a 1/16 of knowing ?)

    > Some faculty members have complained that it is
    > hard to read and see which have been graded so far and which still
    > need to be graded.


    Pay them glasses ...

    Sort the table.
    (on each click on the page a function sorts the table with not graded
    students in first, if all of them are graded an alert is displayed)

    > It has been suggested that we change the
    > background color of the selected letter grade to a different color. I
    > have had some sucess with this, but haven't figured out how to
    > "toggle" the color on and off based on the state of the radio button.


    You only need to give a background color to the student's row, when a
    radio of this row is chosen (that's to say when this row is clicked).
    Some browsers doesn't accept to colorize radio (nor any other button).

    > I can get it to change color when selected,


    checked !

    > but the color persists if
    > another radio button is selected. Does anyone have some sample code
    > for this?


    A simple onclick in each tag TR of students
    that changes or gives a class (css) to this element.


    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
    ASM, Feb 15, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Clark
    Replies:
    1
    Views:
    546
  2. Todd
    Replies:
    3
    Views:
    689
    Michael Jung
    Aug 30, 2007
  3. Hiten
    Replies:
    1
    Views:
    609
    Vidar Petursson
    May 26, 2004
  4. sam
    Replies:
    1
    Views:
    97
    Dag Sunde
    May 26, 2006
  5. Replies:
    1
    Views:
    125
Loading...

Share This Page