Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JavaScript- Debugging one of my nine check boxes won't checkmark

    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!

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,969
    Thanks
    56
    Thanked 557 Times in 554 Posts
    wouldn't that be this line here:
    Code:
    box.checked = false;
    ?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •