This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes setting a radio button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "setting a radio button" Watch "setting a radio button" New topic

setting a radio button

Joseph Miller

Joined: Jun 19, 2001
Posts: 21
anyone know how to set a radio button checked with javascript? I'm confused because they have the same name...
<input type=radio name='exampleRadio' value='1'>
<input type=radio name='exampleRadio' value='2'>
so if I want to set the value 2 radio button to checked based on some other user action how do I do it? this.formName.exampleRadio.checked...
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
Here is a brief example:

Note change "on-Click" to "onClick", had to post the code like this
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: setting a radio button
Similar Threads
how to retrieve data into radiobuttons
Pass radio button to servlet
selecting a radio button for IE & Netscape
Radio Buttons