I am working with a javascript function that takes the meaning of some questions using RadioButtons from YES or NO. To get the value of a single question (Q1), I do something like this:
for (i=0; i<document.form1.Q1.length; i++){
if(document.form1.Q1[i].checked)
Array[0] = document.form1.Q1[i].value;
}
I have to do this for each question, so the code becomes very long. So I am trying to create a function or loop in which the name of the question changes. My only problem is that I do not know how to use the variable on document.form1.VARIABLE.value. I already tried several ways, but did not work.
Can anyone help me with this?
Thank you so much!
source
share