Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Looping though multiple fields - misnamed as [Javascript] Named Layers in IE
- From: javascript@xxxxxxxxxx (Lau)
- Subject: Looping though multiple fields - misnamed as [Javascript] Named Layers in IE
- Date: Tue, 28 Aug 2001 04:40:15 +1000
Thanks Tom,
Unfortunately this script doesn't handle the cases where the number of fields in 0 or 1.
I can add in the convoluted extra bits to handle these cases but I'm hoping there's another way.
I vaguely remmember reading something where they did this by looping through the collection rather
than an array.... any ideas?
Thanks
Lau
----- Original Message -----
From: TomMallard <mallard@xxxxxxxx>
To: <javascript@xxxxxxxxxx>
Sent: Tuesday, August 28, 2001 4:07 AM
Subject: Re: [Javascript] Named Layers in IE
> 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@xxxxxxxxxxxxxxxx>
> To: <javascript@xxxxxxxxxx>
> 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@xxxxxxxxxx
> > http://www.LaTech.edu/mailman/listinfo/javascript
> >
>
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> http://www.LaTech.edu/mailman/listinfo/javascript
>
>
- Follow-Ups:
- References:
- [Javascript] Named Layers in IE
- From: Jay Lepore
- [Javascript] Named Layers in IE
- From: Lau
- [Javascript] Named Layers in IE
- From: TomMallard
- [Javascript] Named Layers in IE
- Prev by Date: [Javascript] Named Layers in IE
- Next by Date: Looping though multiple fields - misnamed as [Javascript] Named Layers in IE
- Previous by thread: [Javascript] Named Layers in IE
- Next by thread: Looping though multiple fields - misnamed as [Javascript] Named Layers in IE
- Index(es):