0 Replies Latest reply on Feb 27, 2010 6:03 PM by JonnyDL-HV74P1

    Javascript Menu Items

    JonnyDL-HV74P1 Level 1

      I have code that loads up a form from a popup window, but It will repeat the value if you choose it again. I cant seem to get it to compare all the options in the second menu to what is being selected, and if its the same as any of them it ignores it. I'm pretty sure I need a for loop to compare each option to what is selected. I have an onchange call in the html. This is the code I have it always give option==option result. can anyone see what I'm doing wrong

      (the code currentlly just shows me the comparisons)

      function addservice()

      {

      var duped=true;

      var provider= new Option();

      provider.text=document.offers.service.value

      provider.value=document.offers.service.value

      nextitem=document.offers.selection.options.length

      document.offers.selection.options[nextitem]=provider

      for(i=0; i<=nextitem;  ++i)

      {

      if (document.offers.selection.options[nextitem].value==provider.value)

      {

      var duped=true

      }

      else

      {

      var duped=false

      }

      }

      alert(document.offers.selection.options[nextitem].value+" compare "+provider.value)

      }