I have this function:
Form is a form object, and name is a string of the name of the radio button.
I thought it was trying to use the variable name as the name of a field. For example:
Instead of form.fruits its using form.name. Basically I am trying to use the variable as a string.
Is there anyway around this?
Code:
function SelectedRadio(form, name) { for(var i = 0; i < form.name.length; i++) { if(form.name[i].checked == true) { return form.name[i].value; } } return "Error!"; }
I thought it was trying to use the variable name as the name of a field. For example:
Code:
function OnFormSubmit(form) { SelectedRadio(form, "fruits") }
Is there anyway around this?
Comment