...

View Full Version : JavaScript- Debugging one of my nine check boxes won't checkmark



sehanlorun
09-27-2012, 10:47 PM
Hello-

I am creating an iPad article and there is a part where when the user checks all nine requirements a sound is triggered. The problem is the sound goes off after the 9th box is hit but a check mark does not appear....

<script type="text/javascript">
//<![CDATA[

function zombieCount(which) {

var minChecked =9;
var count = 0;
var box;

if(document.getElementById("zombiesForm").habitat.checked == true) {
if(which == "habitat") {
box = document.getElementById("zombiesForm").habitat;
}
count++;
}
if(document.getElementById("zombiesForm").apparel.checked == true) {
if(which == "apparel") {
box = document.getElementById("zombiesForm").apparel;
}
count++;
}
if(document.getElementById("zombiesForm").eyes.checked == true) {
if(which == "eyes") {
box = document.getElementById("zombiesForm").eyes;
}
count++;
}
if(document.getElementById("zombiesForm").arms.checked == true) {
if(which == "arms") {
box = document.getElementById("zombiesForm").arms;
}
count++;
}
if(document.getElementById("zombiesForm").posture.checked == true) {
if(which == "posture") {
box = document.getElementById("zombiesForm").posture;
}
count++;
}
if(document.getElementById("zombiesForm").vocals.checked == true) {
if(which == "vocals") {
box = document.getElementById("zombiesForm").vocals;
}
count++;
}
if(document.getElementById("zombiesForm").loco.checked == true) {
if(which == "loco") {
box = document.getElementById("zombiesForm").loco;
}
count++;
}
if(document.getElementById("zombiesForm").feeding.checked == true) {
if(which == "feeding") {
box = document.getElementById("zombiesForm").feeding;
}
count++;
}
if(document.getElementById("zombiesForm").behavior.checked == true) {
if(which == "behavior") {
box = document.getElementById("zombiesForm").behavior;
}
count++;
}

if(count == minChecked) {
box.checked = false;
document.getElementById("brains").play();
}
}
//]]>
</script>


thanks!

xelawho
09-27-2012, 10:50 PM
wouldn't that be this line here:

box.checked = false;
?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum