[Javascript] gping thrui the select options and checking iof there is any selected

Flavio Gomes flavio at economisa.com.br
Tue Jun 8 15:24:29 CDT 2004


Don't forget to check if the type = "radio" for radio and if the tagName 
= "SELECT" for selects

---
Flavio Gomes
flavio at economisa.com.br



dev at qroute.net wrote:

>Following code checks if there is any check/radio box is checked;
>
>        CurRadioChecked=false
>        for(var x = 0; x <
>window.document.frmSurvey.anObjectNameHere.length; x++)
>        {
>         if (window.document.frmSurveyanObjectNameHere[x].checked)
>         {
>          CurRadioChecked= true;
>          break;
>         }
>        }
>
>What if the object is not a radio/checkbox, but a select box ? How do you
>find out if there is any item is selected ?
>Assumption :
>
>First option in the select  box would be "SELECT ONE FROM LIST" and it would
>by default is the selected one and its value would be "" ( empty string )
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>



More information about the Javascript mailing list