Script Categories













Forms >>> Checkbox Counter.

Easily count the number of checkboxes that have been selected.

1
2
3
4
5
6
7
8
9

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function anyCheck(form) {
var total = 0;
var max = form.ckbox.length;
for (var idx = 0; idx < max; idx++) {
if (eval("document.playlist.ckbox[" + idx + "].checked") == true) {
    total += 1;
   }
}
alert("You selected " + total + " boxes.");
}
//  End -->
</script>
<form method="post" name=playlist>
1<input type=checkbox name=ckbox>
<br>2<input type=checkbox name=ckbox>
<br>3<input type=checkbox name=ckbox>
<br>4<input type=checkbox name=ckbox>
<br>5<input type=checkbox name=ckbox>
<br>6<input type=checkbox name=ckbox>
<br>7<input type=checkbox name=ckbox>
<br>8<input type=checkbox name=ckbox>
<br>9<input type=checkbox name=ckbox>
<br><input type=button value="Count Checkboxes" onClick="anyCheck(this.form)">
</form>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

Bitcoin Gambling Site . loansolo.com bbb


©