Radio Buttons/Option Group

Discussion in 'HTML' started by Mokoena, Jul 2, 2003.

  1. Mokoena

    Mokoena Guest

    How do I get radio buttons to work in HTML, so that only one in a group can
    be selected at a time? How do I get the value returned from them? How do I
    reference them in JavaScript? What value is returned?

    Muchos Gracias.
    Mokoena, Jul 2, 2003
    #1
    1. Advertising

  2. Mokoena

    Steve Pugh Guest

    "Mokoena" <> wrote:

    >How do I get radio buttons to work in HTML, so that only one in a group can
    >be selected at a time?


    Give them all the same name.

    >How do I get the value returned from them?


    Include the appropriate URI in the action attribute of the form.

    >How do I reference them in JavaScript?


    document.forms.elements
    or
    document.formname.elementname
    or
    document.getElementById("id")

    >What value is returned?


    name=value

    So,
    <input type="radio" name="cheese" value="cheddar">
    <input type="radio" name="cheese" value="stilton
    <input type="radio" name="cheese" value="brie">
    <input type="radio" name="cheese" value="roquefort">

    Will on submission of the form return cheese=stilton if the second
    radio button is selected.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Jul 2, 2003
    #2
    1. Advertising

  3. Mokoena

    brucie Guest

    brucie, Jul 2, 2003
    #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. Bisser Milanov
    Replies:
    2
    Views:
    522
    Bisser Milanov
    Jun 26, 2003
  2. Scott D Johnson
    Replies:
    1
    Views:
    1,045
    Scott D Johnson
    Sep 27, 2006
  3. Mokoena

    Radio Buttons/Option Group

    Mokoena, Jul 2, 2003, in forum: Javascript
    Replies:
    1
    Views:
    86
    Steve Pugh
    Jul 2, 2003
  4. Dr. Leff
    Replies:
    3
    Views:
    279
    David Mark
    Oct 15, 2007
  5. Dr. Leff
    Replies:
    3
    Views:
    211
    David Mark
    Oct 15, 2007
Loading...

Share This Page