Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes radio buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "radio buttons" Watch "radio buttons" New topic
Author

radio buttons

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
Hello,
I have 2 radio buttons using the same name in a form:

I have a reset button in form that calls the function resetFields.
How can I change the checked button back to the 'Male' option
in this function.

I am tying to use something like...


But that isn't quite right.
Any ideas? Thanks.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
It is an array

document.formName.gender[0].checked = true;

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: radio buttons
 
Similar Threads
Question on using DisplayTag in JSPs
Using Struts Creating the Radio Button for gender
setting a radio button
Radio Validator
code attached element existance in javascript