- From: Garrett Smith <dhtmlkitchen@gmail.com>
 - Date: Mon, 20 Mar 2006 11:34:11 -0800
 - To: www-dom@w3.org
 
you should use getElementsByName
On 3/16/06, Waters, Tyler S FOR:EX <Tyler.Waters@gov.bc.ca> wrote:
>
>
>
> Hi.
>
> I'm curious if I'm missing something when it comes to using .getElementById
> on radio buttons.
>
> Say I have a series of radio buttons.
> Since I want the user to select only one, they all need to have the same
> name, let's say 'radioname'….  If they have different names, the user can
> select more than one.
>
> Now ideally, I would like to call document.getElementById('radioname') and
> have an array of radio button elements returned, but instead all I get is
> the first one.
>
> I am forced into using
> document.formname.elements.radioname[0],
> document.formname.elements.radioname[1],
> document.formname.elements.radioname[2] etc.
>
> I think this is a major shortfall with the DOM… so close to being the best,
> yet so far away when it comes to radio buttons..
>
> Unless of course I'm missing something… Am I ?
>
> Thanks
>
> Tyler Waters
> Auxiliary Web Analyst
> Ministry of Forests and Range
> Revenue Branch
> mailto:Tyler.Waters@gov.bc.ca
--
http://dhtmlkitchen.com/
Received on Monday, 20 March 2006 19:34:22 UTC