By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,382 Members | 1,637 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,382 IT Pros & Developers. It's quick & easy.

Radio Buttons/Option Group

P: n/a
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.
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Mokoena" <mo*****@amstel.com> 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[i].elements[i]
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 <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #2

P: n/a
In post <mi********************************@4ax.com>
Steve Pugh said...
<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">


http://www.intriguing.com/mp/_sounds/lb/cheese.wav

--
brucie a. blackford. 02/July/2003 08:02:26 pm kilo.
http://loser.brucies.com/
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.