HighDots Forums  

Radio Buttons/Option Group

Javascript JavaScript language (comp.lang.javascript)


Discuss Radio Buttons/Option Group in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mokoena
 
Posts: n/a

Default Radio Buttons/Option Group - 07-02-2003 , 05:08 AM






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.



Reply With Quote
  #2  
Old   
Steve Pugh
 
Posts: n/a

Default Re: Radio Buttons/Option Group - 07-02-2003 , 05:54 AM






"Mokoena" <mokoena (AT) amstel (DOT) com> wrote:

Quote:
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.

Quote:
How do I get the value returned from them?
Include the appropriate URI in the action attribute of the form.

Quote:
How do I reference them in JavaScript?
document.forms[i].elements[i]
or
document.formname.elementname
or
document.getElementById("id")

Quote:
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 <steve (AT) pugh (DOT) net> <http://steve.pugh.net/>


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.