HighDots Forums  

Check Boxes Count number checked

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Check Boxes Count number checked in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mel Lockett
 
Posts: n/a

Default Check Boxes Count number checked - 07-21-2004 , 12:08 PM






I have a webpage with 20 questions on it each having a unique check box.
Visitors are asked to check the question if the conform.
At the foot of the page, I want to show the total number of checkboxes that
are checked.
How do I achieve this?

Mel Lockett


Reply With Quote
  #2  
Old   
Paul Whitham TMM
 
Posts: n/a

Default Re: Check Boxes Count number checked - 07-21-2004 , 06:03 PM






If you want this to appear on the same page, I would suggest you look at the
calculate form from www.yaromat.com

--
Regards

Paul Whitham
Macromedia Certified Professional for Dreamweaver MX2004
Valleybiz Internet Design
www.valleybiz.net

Team Macromedia Volunteer for Ultradev/Dreamweaver MX
www.macromedia.com/support/forums/team_macromedia

"Mel Lockett" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
I have a webpage with 20 questions on it each having a unique check box.
Visitors are asked to check the question if the conform.
At the foot of the page, I want to show the total number of checkboxes
that
are checked.
How do I achieve this?

Mel Lockett




Reply With Quote
  #3  
Old   
Mick White
 
Posts: n/a

Default Re: Check Boxes Count number checked - 07-21-2004 , 11:24 PM



Mel Lockett wrote:

Quote:
I have a webpage with 20 questions on it each having a unique check box.
Visitors are asked to check the question if the conform.
At the foot of the page, I want to show the total number of checkboxes that
are checked.
How do I achieve this?

<script type="text/javascript">
function howManyCheckboxesChecked(frm){
var f=frm.length,boxesChecked=0;
while(f--){
if(frm[f].type=="checkbox" && frm[f].checked){
boxesChecked++;
}
}
return boxesChecked;
}
</script>

The function returns the number of checkboxes checked. (Just pass the
form object as a parameter to the function)

<p id="foo" ></p>
<a href="javascript: void()"
onclick="document.getElementById('foo').innerHTML=
howManyCheckboxesChecked(document.forms[0]);return false;">click</a>

Mick
Quote:
Mel Lockett


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.