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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy How to solve this...

    1)HOW TO SET THE DECIMAL TO 1 OR 2 POINT ONLY
    2)HOW TO MAKE SURE ALL THE QUESTIONS ANSWERED B4 PERCENTAGE IS CALCULATED
    why it is not working in firefox?
    HERE IS THE EDITED CODE.

    var numOfGroups = 12;

    function calc() {
    var score = 0;
    for (var j=1; j<=numOfGroups; j++) {
    var f = document["myform"]["ques"+j];
    for (var i=0; i<f.length; i++) {
    if (f[i].checked) {
    score += Number(f[i].value /72 *100);
    }
    }
    }
    //confused here..do i need to create new function somenthing like this
    function showScore() {
    if(answered != answers.length) {
    alert("You have not answered all of the questions yet!");
    return false; OR
    }

    //if numOfGroups != 12 {

    alert("You have not answered all of the questions yet!");
    }
    else{

    alert ("Your Score is " + score);
    return false;


    }
    </script>

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,158
    Thanks
    203
    Thanked 2,548 Times in 2,526 Posts
    Why have you started a new thread? You have already asked this question at
    http://www.codingforums.com/showthre...78#post1197578
    Please have a look at the forum rules.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry how to delete this.................


  •  

    Posting Permissions

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