Forum Moderators: open
for example:
var somevar = 1
The problem in my function is that line of code:
document.form1.radiobtn("+somevar+")[i].checked=false;
Probably It's a syntax error but I tried all the possibilities and it still doesn't work properly.
I would be very thankful for your help.
The name of radio button is radiobtn + somevalue...
I would have thought that you'd want to give all radio buttons (at least in the same group) the same name. If they don't have the same name then they won't behave as a radio group. Or have I got the wrong end of the stick? You can then access these as an array.
If all your radio buttons have the name 'radiobtn', then you can use:
document.form1.radiobtn[i].checked = false;
<edit>
Actually, thinking about it, if you do have several groups of radio buttons, then I think you should be able to do something like:
document.form1.elements["radiobtn"+somevar][i].checked = false;