1

For a project I need to understand a site script, but i happen to come by this function, and i dont understand what the if is all about.

Form == navBar, entries == Students, flag == 0   

Can someone explain me which if statement is used now, and why?

function PopulateElementOption(Form, entries, flag)
  {
   var idx = 0;
   if (flag & 1)
   {
     Form.element[0] = new Option("-All-", 0);
     idx++;
   }
   if (flag == 0 || flag & 2)
   {
    for (i = 0; i < entries.length; i++, idx++)
    {
      Form.element[idx] = new Option(entries[i], i+1);
    }
   }
   if (idx > 0)
   {
    Form.element.selectedIndex = 0;
    doDisplayTimetable(Form, topDir);
   }
  }

0 Answers0