Jump to content
php.lv forumi

atzīmējam visus checkbox


Vebers

Recommended Posts

<script LANGUAGE="JavaScript">

<!-- Begin
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Neatzīmēt visu"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Atzīmēt visu"; }
}
//  End -->
</script>

<input type="checkbox" name="list[]" value="1"/>
<input type="checkbox" name="list[]" value="2"/>

<input class="button" type=button value="Atzīmēt visu" onClick="this.value=check(this.form.list)"/>

 

kā lai panāk to ka lai atzīmējas visi checkboxi ? ir tā ka checkbox'am name=list tad darbojas, bet man nepiecieshams vinjus ievaakt kaa array...

Link to comment
Share on other sites

×
×
  • Create New...