PDA

View Full Version : Is a radio Radio Box checked?


MattMattMatt
03-08-2003, 11:41 AM
How do I tell if a radio box is checked?
is there something like
document.q1.b.checkidity?

Or, is there a way to find out which radio box is ticked in a form?

Thanks for anyhelp.
Matt

Mhtml
03-08-2003, 11:58 AM
You can check it like this..

myForm.myRadioButton.checked


Example:

if (myForm.myRadioButton.checked !== true)
{
alert("Hey! You didn\'t make a selection!")
}



Happy coding, :)...

MattMattMatt
03-08-2003, 12:18 PM
Thanks very much, but I am still a bit stuck.

I need to add one to the score (yes, i am doing a quiz), only if a particular box is selected.

Your piece of code asks if all the boxes in the form are ticked, rather than if a particular box is ticked.

I can't give each option a seperate name (and then ask if it is ticked) because if the names are different, all the boxes can be ticked.

MattMattMatt
03-08-2003, 01:39 PM
I think I've got it working now. Thanks.
No more help needed.

Mhtml
03-09-2003, 12:20 AM
No worries. :)

MattMattMatt
03-09-2003, 10:15 AM
I used on click to flag each question as wrong or right.
http://wbie.tripod.com/quiz.html