Lasse Reichstein Nielsen wrote:
Quote:
>Ed Jay <edMbj@aes-intl.comwrites:
>
Quote:
>I'm trying to put:
>>
>document.form1.proto0[0].checked=true;
>document.form1.proto1[0].checked = true;
>document.form1.proto2[0].checked = true;
>>
>into a loop.
>
Quote:
>and I've been unsuccessful using:
>>
>for (var i=0;i<n+1;i++) {
>document.forms["form1"].elements["proto"+i+"[0]"].checked=true;
>>}
>
Quote:
>Syntax-wise, where am I going astray?
>
>The [0] is not part of the name. The name is "proto2", and there
>are apparently more elements in the form with that name.
>Try:
>
var elems = document.form["form1"].elements;
for(var i = 0; i < n; i++) {
elems["proto"+i][0].checked = true;
}
>
Thanks, but it's not working. I continue to receive an error msg:
"Cannot convert undefined or null to Object." (The original multi-line,
non-loop command works fine.)
By way of elaboration, this issue pertains to multiple rows of radio button
pairs that I'm setting pursuant to a previous condition being met, e.g.,.
proto0[0] and proto0[1], etc.
--
Ed Jay (remove 'M' to reply by email)
Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info