Kod
var produkty = new Array('Zoho_Faktury','Zoho_CRM','Zoho_Kadry','Zoho_Projekty','Zoho_Business','Zoho_Spotkania','Zoho_Wiki','Zoho_Docs','inne_p');
var ile=0;
var n=0;
// zliczanie pol ktore maja wartosc chcecked
for ( n = 0; n < produkty.length; ++n)
{
if (document.getElementById(produkty[n]).checked==true){
ile = ile+1;}
}
alert(ile)
var ile=0;
var n=0;
// zliczanie pol ktore maja wartosc chcecked
for ( n = 0; n < produkty.length; ++n)
{
if (document.getElementById(produkty[n]).checked==true){
ile = ile+1;}
}
alert(ile)
teoretycznie ta pętla powinna zwracać liczbę zaznaczonych checkboxów o id = elementom tablicy produkty tyle że tak nie jest FireBug krzyczy:
document.getElementById(produkty[n]) is null
Wie ktoś co robię źle?