6 Sie 2008

Obliczania na formularzu

var fld_name;
var idx, nr;
cnt = f.elements.length;

for(i=0; i<cnt; i++){
 if(f.elements[i].name.indexOf(„kwota_budzetu_”)!=-1) {
  fld_name = f.elements[i].name;
  idx = fld_name.lastIndexOf(„_”)+1;
  nr = fld_name.substr(idx);

  f.elements[„roznica_proj_”+nr].value =
   eval(f.elements[„kwota_budzetu_”+nr].value) –
   eval(f.elements[„wartosc_proj_”+nr].value);
 }
}