[Javascript] How do you cycle thru the radio buttons on awebform ?

Hakan Magnusson hakan at backbase.com
Wed Jun 2 11:01:13 CDT 2004


> for(var z = 0; myForm[z]; z++)

Lovely. Just lovely. :)

Regards,
H

Flavio Gomes wrote:
> Hmm nope  for(var z = 0; z < window.document.frmSurvey.length; z++)
> It'll loop on frmSurvey usually I do a bit different: for(var z = 0; 
> myForm[z]; z++)
> 
> function loopsOnForm(myForm)
> {    sForm = '';
>   for(var z = 0; myForm[z]; z++)
>   {  sForm += myForm[z].name+': \t'+myForm[z].type }
>   alert(sForm);
> }
> 
> 
> To loop on form I believe It'll be document.forms or document.all.forms 
> (IE only)
> 
> ---
> Flavio Gomes
> flavio at economisa.com.br
> 
> 
> Chris T wrote:
> 
>>> I got this script so far, but cannot read the length of the radio 
>>> objects
>>>
>>> for(var z = 0; z < window.document.frmSurvey.length; z++){
>>>
>>> if ( window.document.frmSurvey[z].type == 'radio' )
>>> {
>>>  var CurRadioChecked=false
>>>   
>>
>>
>> Doesn't that bit of code loop through all the FORMS on a page, not the
>> elements within a form? From the looks of it, I'd say yes.
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript at LaTech.edu
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>  
>>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 



More information about the Javascript mailing list