Getting the amount of selected in <SELECT

Results 1 to 2 of 2

Thread: Getting the amount of selected in <SELECT

  1. #1
    Join Date
    Dec 1969

    Default Getting the amount of selected in <SELECT

    Hi!!<BR><BR>I have a Dropdown box with Multiple choice option.<BR>I want to know how many options has been choosed.<BR><BR>Note: all the value in this Option is from DATABASE ..<BR>which is dyanamic<BR><BR>Bikash<BR><BR><BR>

  2. #2
    Mehmet Guest

    Default RE: Getting the amount of selected in <SELECT

    Here is a function that put all the selected items in an array<BR><BR>Call the function as Get_SelectedItems(document.Myform.MySelect)<BR><BR >replace MyForm and MySelect with yours.<BR><BR>function Get_SelectedItems(objList){<BR> //finds all the selected items in a drop down list box and inserts them into an array<BR> var arrSelectedItems = new Array();<BR> var intListItem;<BR> var intArrayItem=0;<BR> //go through each item in the list <BR> for (intListItem=0; intListItem &#060; objList.length; intListItem++){<BR> //check if it is is selected or not<BR> if (objList.options[intListItem].selected == true){ <BR> //put the item in the array<BR> arrSelectedItems[intArrayItem] = objList.options[intListItem].text;<BR> intArrayItem++; <BR> } <BR> }<BR>}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts