[Javascript] Named Layers in IE

TomMallard mallard at serv.net
Mon Aug 27 13:07:28 CDT 2001


If you have more than one element with the same name, when you use
document.form1.MyField you get the collection, then loop through that to get
the names.

var arrMyField = document.Form1.MyField;
if(arrMyField.length>0){
    for(i=0;i<arrMyField.length;i++){
        ...process arrMyField[i].name...
    }
}

tom mallard
seattle
----- Original Message -----
From: "Lau" <lau at goldenweb.com.au>
To: <javascript at LaTech.edu>
Sent: Monday, August 27, 2001 10:21 AM
Subject: Re: [Javascript] Named Layers in IE


> I have a FORM that may have N fields with the same name.
> How can I loop through them when I don't know how many there are... there
may be none.
>
> something like this:
>
> for (i=1;i<N;i++){
>   alert(document.Form1.MyField[i])
> }
>
> Thanks in advance
> Lau
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
>




More information about the Javascript mailing list