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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating a Script that Calculates Test Scores

    I'm an eLearning developer and use Dreamweaver to create most of my courses. I'm able to do most of the things needed for these courses; however, my company just asked me to step out of the box and I'm not sure how to go about doing this.

    I need to create a page that allows auditors to listen to customer service calls and 'score' them based on a 1 - 5 grading scale. There are 18 questions that need to be answered based on the grading scale. Once the scoring is completed, the program needs to calculate the score (based on the 18 questions) and forward the final score to their boss.

    I'm assuming a javascript can do this; however, I have no idea how to create it. Any help is greatly appreciated!!

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    Of course you can use JavaScript to do this for you. Though, I would suggest that you use a server side technology so that you can record this information in a database and as such...get the overall score.

    Here is an example....first html

    Code:
    <form action="collect_scores.php" method="POST">
    
    <p><input type="radio" name="question1" value="1">1<br>
    <input type="radio" name="question1" value="2">2<br>
    <input type="radio" name="question1" value="3">3<br>
    <input type="radio" name="question1" value="4">4<br>
    <input type="radio" name="question1" value="5">5<br>
    <input type="radio" name="question1" value="6">6</p>
    
    <p><input type="radio" name="question2" value="1">1<br>
    <input type="radio" name="question2" value="2">2<br>
    <input type="radio" name="question2" value="3">3<br>
    <input type="radio" name="question2" value="4">4<br>
    <input type="radio" name="question2" value="5">5<br>
    <input type="radio" name="question2" value="6">6</p>
    
    <input type="submit" value="Submit"/>
    </form>
    second the php

    PHP Code:
    <?php
    $question1 
    $_POST['question1'];
    $question2 $_POST['question2'];

    $total $question1 $question2;

    echo 
    "Total Score: " $total;
    ?>
    By the way...you can also use Ajax..to this as well...with PHP, or other scripting language.

    Good luck.
    ess

  • #3
    Regular Coder
    Join Date
    Oct 2006
    Posts
    107
    Thanks
    3
    Thanked 5 Times in 5 Posts
    How's this?
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">
    <
    HTML>
    <
    HEAD><TITLE>Average Score  </TITLE>
    <
    META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <
    meta http-equiv="Content-Style-Type" content="text/css">
    <
    meta http-equiv="Content-Script-Type" content="txt/javascript">
    <
    STYLE type=text/CSS>

    </
    STYLE>
    <
    SCRIPT type="text/javascript">
    var 
    Q= new Array('one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifeteen','sixteen','seventeen','eighteen');
    function 
    avg(){
    k=document.forms[0].elements.length;
    for(
    i=0,j=0;i<k;i++){j+=document.forms[0].elements[i].value*1}

    j=j/k
    alert
    (j)
    }
    </SCRIPT>
    <META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
    <BODY>
    I need to create a page that allows auditors to listen to customer service calls and 'score' them based on a 1 - 5 grading scale. There are 18 questions that need to be answered based on the grading scale. Once the scoring is completed, the program needs to calculate the score (based on the 18 questions) and forward the final score to their boss.
    <form>
    <TABLE BORDER="1">
     <TBODY>
    <SCRIPT type="text/javascript">
    var s='';
    for(i=0;i<Q.length;i++){k='';s+='<tr><td><B>Question</B> '+Q[i]+'</td><td><SELECT><OPTGROUP label="Score">';
                            for(j=1;j<=5;j++){k+='<OPTION value="'+j+'">'+j+''}
                            s+=k+'</select>'}
    document.write(s)
    </SCRIPT>
      </TR>
     </TBODY>
    </TABLE>
    </form>
    <button onclick="avg()">Average</button>

    </BODY></HTML> 

  • #4
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just wanted to say thanks. I'm going to try your suggestions. I really appreciate it!!


  •  

    Posting Permissions

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