"Grant Wagner" <gwagner@agricoreunited.com> wrote in message news:qaMNd.179$3d3.550@news2.mts.net...[color=blue]
> "WindAndWaves" <access@ngaru.com> wrote in message
> news:f%FNd.15724$mo2.1234540@news.xtra.co.nz...[color=green][color=darkred]
> >> var els = document.forms[0].elements,
> >> rBoxes = [], //collection
> >> el,
> >> i = 0;
> >> while (el = els[i++])
> >> if (el.type == 'checkbox'
> >> && /^r/i.test(el.name))
> >> rBoxes.push(el);
> >> 2)
> >>
> >> if (el.type == 'checkbox'
> >> &&/^r/i.test(el.name))
> >> {...do something with it
> >>[/color]
> > Cool thanks, I will push them I think. Great. Thanks for your help.[/color]
>
> If you know what you want to do with the form elements right away, then
> why pass through the elements collection once, then pass through the
> list of matching elements a second time?
>
> var f;
> if ((f = document.forms) &&
> (f = f['yourForm']) &&
> (f = f.elements))
> {
> var ii = f.length;
> while (ii-- > 0)
> // or
> // for (var ii = 0; i < f.length; ++ii)
> // if direction matters
> {
> if (f[ii].type == 'checkbox' &&
> /^r/i.test(f[ii].name))
> {
> // do something with f[ii]
> }
> }
> }
>
> --
> Grant Wagner <gwagner@agricoreunited.com>
> comp.lang.javascript FAQ -
http://jibbering.com/faq
>
>[/color]
Thank you Grant.