NBS Posted June 28, 2008 Report Posted June 28, 2008 Sveiki, man ir tāda lieta, ka es vēlētos izveidot funkciju, kas izlaižs caur ciklu cik daudz checkbox checked un visus šos checkboxus, kas ir atzīmēti nosūta, visus pēc ID uz print.php?=$id. Izveidoju kaut ko šādu: function checkbox(form) { var url = "print.php"; var visi = 0; var max = form.checkbox.length; for (var idx = 0; idx < max; idx++) { if (eval("document.form[" + idx + "].checked") == true) { visi += 1; } } alert("Atzimeti " + visi "); }
marcis Posted June 28, 2008 Report Posted June 28, 2008 function checkbox(what){ var visi = ""; var max = what.elements.length; for (idx=0;idx<max;idx++){ if(what.elements[idx].type=="checkbox" && what.elements[idx].checked==true){ visi+=what.elements[idx].value+","; } } alert("Atzimeti: "+visi); }
Recommended Posts