Two Laptop Bag
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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "radio buttons" Watch "radio buttons" New topic

radio buttons

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 750
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

Joined: Nov 08, 2001
Posts: 15385
It is an array

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

I agree. Here's the link:
subject: radio buttons
It's not a secret anymore!