-
February 19th, 2004, 02:53 AM
#1
Senior Member
How to count checkboxes checked...
Hi all, I want to know how to count how many checkboxes checked by user, the result will be processed in submit.asp and then timed with number 2. Lastly, the final result will be displayed to the user. I need the code in JavaScript. Please Help me....
---------------------------------------------------------------------------------
<html>
<body>
<form action="submit.asp" name="submit" method="post">
<p><h3>Stage 1</h3>
<input type="checkbox" name="cb" value="ON"><br>
<input type="checkbox" name="cb" value="ON"><br>
<input type="checkbox" name="cb" value="ON"><br>
<input type="checkbox" name="cb" value="ON"><br>
<input type="checkbox" name="cb" value="ON"><br>
<input type="reset" name="cmdreset" value="Reset">
<input type="Submit" name="cmdsubmit" value="Submit">
</P>
</form>
</body>
</html>
--------------------------------------------------------------------------------
-
February 20th, 2004, 12:03 PM
#2
Well, you need to first give each checkbox a unique name, then check it's value and see if it is set to 'on' - loop through all the checkboxes on the form and keep a count of the ones that are.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|