IntelliJ Java IDE
The moose likes HTML, CSS and JavaScript and the fly likes RadioButton Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "RadioButton" Watch "RadioButton" New topic
Author

RadioButton

Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
My form has 3 radio buttons,
<input type="radio" name="type" value="Systems" checked/>
systems
<input type="radio" name="type" value="machines" />
Machines
<input type="radio" name="type" value="Misc" />
Misc

I am trying to get the value of the checked checkbox.
I just wrote,
function go() {
alert("h");
if(formname.type.checked)
alert("yes");
}

This is not doing anything
Also, if I say alert(formname.type.checked) it gives me undefined.
What am I missing here ?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
they are arrays
document.formName.type[0].checked
document.formName.type[1].checked
document.formName.type[2].checked
Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Thanks
 
 
subject: RadioButton
 
Threads others viewed
inconsistency in radiobutton
Radio Buttons
setting a radio button
help with radio buttons
Radio button not working
developer file tools