Quick Search:
 
 JavaScript: Count the number of checked checkboxes in a form Jump to:  
Category: >> JavaScript >> Count the number of checked checkboxes in a form  

<< last 

Snippet Name: Count the number of checked checkboxes in a form

Description: This is a javascript function that counts the number of checked checkboxes in a form.

Also see:
» Count the number of checked checkboxes...
» Format money as millions, billions, et...
» Pre-populated List of Countries
» Convert UK Dates To mySQL Format Dates
» Count capital letters in a string
» Calculate the difference between two t...
» RMAN: Format Directives
» USER: connection information
» USER: User Information 2
» USER Information
» USER lock account
» USERS: Lock and Unlock accounts
» SQL*Plus formatting
» Create string by formatting an amount ...
» Count words or terms
» Count rows in all tables
» List security related profile informat...
» REGR_COUNT
» Currency display formatting function
» Number Functions: COUNT
» Number Functions: COUNT (running count)
» Nicely Format File Size
» Flat file counter
» GET and POST variables in hidden form
» Toggle All Checkboxes on or off
» Find Worst Performing Indexes
» Format numbers to two decimal places
» Prevent the 'enter' key from submiting...
» Counting rows
» Output as Word Doc format

Comment: (none)

Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: April 11th, 2012

// this function returns the number of checkboxes 
// that are checked in a form
// pass in the name of the form as 'formname'
// pass in the name of the checkbox group as 'groupname'
 
FUNCTION countCheckboxes(formname, groupname){
   VAR totalChecked= 0;
   VAR max = formname.ckbox.length;
 
   FOR (VAR idx = 0; idx < max; idx++) {
      IF (EVAL("document." + formname + "." + groupname + "[" + idx + "].checked") == TRUE) {
      totalChecked+= 1;
   }
}
 
  RETURN totalChecked;
}
 
 


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org