PDA

View Full Version : Progress bar with checkboxes



SawnDiddle
02-25-2008, 10:56 PM
Is there a code somewhere that creates a progress bar that fills up as people click on checkboxes?

Essentially, I will have a single page with 10 questions. The person will check the first box and the bar or progress meter will say 1 of 10 complete. Then they will hit the next check box and will go to 2 of 10. If they click on say box 5, the first 4 will check off too and the meter will say 5 of 10. Also, is it possible to have it load with say with a certain number of them pre-checked? Like I can have a page with just the first one checked or the first 4 or the first 9?

If not, how would I need to go about in doing something like this? Ajax? Any links that would help me with this? other than HTML and CSS I really don't know much about programming.

jscheuer1
02-26-2008, 04:29 PM
If you know just a bit of javascript, this will work out for you:

http://www.dynamicdrive.com/dynamicindex11/dhtmlprogress2.htm

If not, one of us can show you how.

SawnDiddle
02-27-2008, 02:40 AM
cool, this might be perfect.

Is there a way so that for the links, I can have checkboxes instead? So if it is checked, it does incrCount(10) and when it is unchecked, it is decrCount(10)

jscheuer1
02-27-2008, 02:57 AM
I don't like to micromanage if I don't have to, folks learn more when I don't. The basic way a checkbox works with javascript is:


<input type="checkbox"
onclick="if (this.checked){do_something}else{do_another_thing};">

So I will take your word for it, that the two actions you want are:


if it is checked, it does incrCount(10) and when it is unchecked, it is decrCount(10)


<input type="checkbox"
onclick="if (this.checked){incrCount(10)}else{decrCount(10)};">