DIVX5 Posted July 28, 2007 Report Share Posted July 28, 2007 Jautājums - kādēļ netiek izsauktas funkcijas calculate() un load_dat(fd)?? Pārējais kods izpildās normāli. Ja šīs f-jas izpilda pirms pareja koda, tad tās izsaucas.... Kā pareizi izsaukt šīs f-jas? function load(fy,fm,fd,ty,tm,td) { var i=0; if(document.form1.from_y.options[0].text == fy) { document.form1.from_y.selectedIndex = 0; } if(document.form1.from_y.options[1].text == fy) { document.form1.from_y.selectedIndex = 1; } for(i=0;i<13;i++) { if(document.form1.from_m.options.text == fm) { document.form1.from_m.selectedIndex = i; } } calculate(); load_dat(fd); } Link to comment Share on other sites More sharing options...
cucumber Posted July 28, 2007 Report Share Posted July 28, 2007 Varbut shi f-ja nezin ka vispar eksiste vai ir definetas shadas f-jas. ps. Rakstu kodu izmantojot atstarpes, tabulatoru un liec code tagos. Link to comment Share on other sites More sharing options...
MC_ Posted July 29, 2007 Report Share Posted July 29, 2007 document.form1.from_m.selectedIndex = i; Jo augstaakmineetaa rindinja tev izsauc erroru. Liidzarto JS tālāk neizpildās. Toties izpildītos, ja rakstītu document.form1.from_m.options[i].selected = true; Ja nemaldos, .selectedIndex īpašība ir read only. Link to comment Share on other sites More sharing options...
DIVX5 Posted July 29, 2007 Author Report Share Posted July 29, 2007 Nu tā rindiņa kurā itkā ir kļūda izpilda savu darbu korekti... Nomainot to pret document.form1.from_m.options.selected = true; nekas nemainās. Link to comment Share on other sites More sharing options...
MC_ Posted July 29, 2007 Report Share Posted July 29, 2007 (edited) document.form1.from_y.selectedIndex = 1; document.form1.from_m.selectedIndex = i; Nomainiji abaas vietaas kodaa? Eniivej JS k.kur apraujas / izmet erroru liidz nonaak liidz calculate(); load_dat(fd); Ej pa rindinjai un meklee bugu:) Edit: maybe tev taas formas JS nemaz neatrod ieksh HTML dokumenta... if( document ){ if( document.form1){ alert(' form1 - ok'); if( document.form1.from_m ){ alert('field from_m - ok'); } } } Edited July 29, 2007 by MC_ Link to comment Share on other sites More sharing options...
DIVX5 Posted July 29, 2007 Author Report Share Posted July 29, 2007 Nesaprotu kāpēc, bet lieta tāda, ka document.form1.from_m.options.selected = true; mainīgā i vietā ierakstot ciparu manuāli viss strādā. Kāpēc tā....es pie skaidra saprāta nesaprotu... Link to comment Share on other sites More sharing options...
DIVX5 Posted July 29, 2007 Author Report Share Posted July 29, 2007 Paskatijos IE skaidrojuma par kludu un noversu. Bik cikls bija 1 iteraciju par garu :) Lidz ar to select.option[..]... thats all Link to comment Share on other sites More sharing options...
PheliX Posted July 30, 2007 Report Share Posted July 30, 2007 Ne pa tēmu, bet selectedIndex nav read only... Link to comment Share on other sites More sharing options...
Recommended Posts