Hi
I am calling this function with chkQ("document.responses.q1") and my form has a set of radio buttons named q1. The for loop runs the correct number of times but the var rad_val is always undefined?
Anyone able to spot what I have got wrong?
Cheech
[Peace][Pipe]
I am calling this function with chkQ("document.responses.q1") and my form has a set of radio buttons named q1. The for loop runs the correct number of times but the var rad_val is always undefined?
Code:
function chkQ (id) {
for (var i=0; i < id.length; i++)
{
if (id[i].checked)
{
var rad_val = id[i].value;
}
}
alert("Q1 value = " + rad_val);
}
Anyone able to spot what I have got wrong?
Cheech
[Peace][Pipe]