Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


How to count checkboxes on a webpage?

  • Please log in to reply
2 replies to this topic

#1 PODxt


  • Members
  • 41 posts
  • Gender:Male
  • Local time:01:45 PM

Posted 18 February 2011 - 05:32 AM

Hi, I'm actually creating a little website to sell my DVD collection. I don't have a big experience in web developement so I'm facing some issues pretty quickly.
What I would like to do is to create a webpage listing all my DVDs with their respective cover and under each cover, one checkbox. So far, so good. Where it gets more complicated is when I want to add a counter which will count all checkboxes that are checked on the webpage. So each time a visitor clicks on the checkbox, the webpage will automatically add 1 to the total of the already checked boxes in a frame. I have no idea how to proceed or where to look, so any input would be really appreciated!

Here is my draft for the webpage:

Thanks in advance!

BC AdBot (Login to Remove)


#2 groovicus


  • Security Colleague
  • 9,963 posts
  • Gender:Male
  • Location:Centerville, SD
  • Local time:06:45 AM

Posted 18 February 2011 - 08:01 AM

1. Give each of the boxes a class name, make the class name the same for each check box.
2. Assign an onclick event handler (javascript) for each check box. The event handler looks to see whether or not the box is checked. If the box is unchecked, subtract one from the total. If the box is checked, add one to the total.

#3 southarea


  • Members
  • 11 posts
  • Gender:Male
  • Location:US
  • Local time:07:45 AM

Posted 13 June 2011 - 05:20 AM

Really it was a good reply from you admin, now i know a new thing, for my website as well.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users