Note that the buttons are numbered starting from zero.In this instance for the purpose of illustration, we simply display an alert advising which button was selected (shown in italics).
What follows is my original description of how to validate radio buttons written back in 2001.
At that time this was the only way to do the validation.
Since then developments in Java Script have introduced ways to perform radio button validation in far less obtrusive ways however the less obtrusive code is slightly more complicated and has a significant overhead if you do not use that approach for all of your field validations (as you ought to).
Of course many people still use this means of validating radio buttons simply because the code is easier for them to understand.
So you want to put radio buttons on a form on your page but don't know how to go about validating that one has been selected or determining which one has been selected.