Radio Buttons/Option Group

M

Mokoena

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.
 
S

Steve Pugh

Mokoena said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top