dynamically altering drop downs

Results 1 to 2 of 2

Thread: dynamically altering drop downs

  1. #1
    Join Date
    Dec 1969

    Default dynamically altering drop downs

    i am trying to make a menu bar list<BR>1 - 10 .. if a user selects a &#039;10 max&#039; radio button & <BR>1 - 20 .. if a user selects the &#039;20 max&#039; radio button<BR>and i am trying to do this dynamically, in javascript<BR>but i am having problems getting the menus right,<BR><BR>i am a javascript novice <BR><BR>cheers in advance<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: dynamically altering drop downs

    Try something like this... this is not tested, though.<BR><BR><BR>function Populate_Select(F){<BR>var iMax = F.sel.options.length;<BR>var iRadios = 5; //number of radio buttons<BR>var list_max = 0; //max of select list<BR><BR>for (x=0; x&#060;iRadios; x++){<BR>&nbsp;&nbsp;if (F.radioName[x].checked) list_max = F.radioName[x].value;<BR>}<BR><BR>for(i=iMax-1; i&#062;0; i--){<BR>&nbsp;&nbsp;sel.options[i] = null; // null out in reverse order <BR>}<BR><BR>for (x=0; x&#060;list_max; x++){<BR>&nbsp;&nbsp;F.sel.options[x] = new Option(x, x);<BR>}<BR><BR>} //end function

Posting Permissions

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