Adding <option></option> Dynam

Results 1 to 2 of 2

Thread: Adding <option></option> Dynam

  1. #1
    Join Date
    Dec 1969

    Default Adding <option></option> Dynam

    hi am trying to add options to a select drop down based on what a user chooses from another dropdown in javascript.<BR> var i;<BR> var model = new Array("Grand AM PE","Grand AM SE","Grand AM GE");<BR> for (i=0;i&#060;model.length;i++)<BR> {<BR> var opt = new Option(model[i], i+1);<BR> //alert("test") the alert here works<BR> var sel = document.mainform.themod;<BR> //alert("test") but here it does not work <BR> sel.options[sel.options.length] = opt;<BR><BR> }<BR> }<BR>any suggestions???

  2. #2
    Join Date
    Dec 1969

    Default So check your spelling?

    Of the form name and the field name?<BR><BR>I can&#039;t see how anything else would make <BR> var sel = document.mainform.themod;<BR>"break" the JS code.<BR><BR>Actually, I think it wouldn&#039;t break even if "themod" was wrong. That would just get you a "nothing" value, not an error.<BR><BR>So I&#039;d bet on the spelling of "mainform". Case sensitive, remember?<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