|
Hi there,
I'm working on a JavaScript function for a form.
My form is a survey with about four groups of radio buttons.
I want to create one function that I can return the value from one of the radio button groups by passing the name of the radio button group as a variable.
Here's a sample of the code to get the value of a radio group called "concerts" WITHOUT passing the radio group variable.
function get_radio_value()
{
for (var i = 0; i < document.orderform.concerts.length; i++)
{
if (document.orderform.concerts[i].checked)
{
var rValue = document.orderform.music[i].value;
}
}
}
I want to be able to use the above code for ALL my button groups by passing:
get_radio_value("concerts")
Would I have to use the EVAL function in some way?
Thanks
Donna
|