5 wrz 2008

Dodawanie wartości do selecta

function dodajCombo(sel, dane) {

  var tab_test = new Array();
  var nr = 0;

  sel.options[nr] = new Option("", "");
  nr++;

  cnt = dane.length;
  for (i = 0; i & lt; cnt; i++) {
    if (tab_test[dane[i].id] == undefined) {
      tab_test[dane[i].id] = dane[i].name;
      sel.options[nr] = new Option(dane[i].name, dane[i].id);
      nr++;
    }
  }
}