Results 1 to 3 of 3
  1. #1
    august94 is offline Member
    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Default Submit question scheme data into final score.(New to coding in general)

    Hello, I am trying to do a question scheme for a school project. It's about an English grammar test. I have written 5 questions with two response options each. These options are made as radio buttons. The radio buttons works as intended. Every time you tick the right button you are granted one point. So you can at max get 5 points from the test. What i need is a way to submit these points by a button that ads the points together and says something like: You scored x/5 points. This is pretty basic stuff and it's possible some of my coding is more complicated than it should be. Hope you can help me. Here is two of the 5 questions so you can see what the basic structure looks like. Code here:



    //Spørgsmål 4
    function check()
    {
    document.getElementById("svar7").checked=true

    }
    function uncheck()
    {
    document.getElementById("svar7").checked=false
    }
    </script>
    </head>
    <body>

    <form id="s4">
    4. The old servant served the family________for 40 years.<br />
    <input type="radio" name="colors" id="svar7" />loyally<br />
    <input type="radio" name="colors" id="svar8" />loyal
    </form>
    <script type="text/javascript">
    point=0+point;
    //check();
    a=document.getElementById("svar7").checked;
    if (a){
    point++;
    }
    //document.write("Dine point: "+point);
    </script>
    </body>
    </html>

    </br>
    </br>
    </br>
    <script type="text/javascript">


    //Spørgsmål 5
    function check()
    {
    document.getElementById("svar10").checked=true

    }
    function uncheck()
    {
    document.getElementById("svar10").checked=false
    }
    </script>
    </head>
    <body>

    <form id="s5">
    The teacher,_________had graeat expectations to her stufddents, gave them much homework.<br />
    <input type="radio" name="colors" id="svar9" />there<br />
    <input type="radio" name="colors" id="svar10" />who

    </form>
    <script type="text/javascript">
    point=0+point;
    //check();
    a=document.getElementById("svar10").checked;
    if (a){
    point++;
    }
    document.write("Your points: "+point);

    </script>
    Last edited by august94; 02-18-2012 at 09:58 PM. Reason: More info about problem

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default Re: Submit question scheme data into final score.(New to coding in general)

    Javascript != Java. I'd suggest finding a javascript forum to get better help.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default Re: Submit question scheme data into final score.(New to coding in general)

    Agreed. Locking up here.

    db

    THREAD CLOSED
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. General question about the forum
    By KhachQuy in forum Suggestions & Feedback
    Replies: 3
    Last Post: 05-09-2011, 03:44 AM
  2. submit data using ajax
    By mrunal123 in forum Java Servlet
    Replies: 2
    Last Post: 02-03-2011, 08:26 AM
  3. A general question
    By wizar in forum New To Java
    Replies: 6
    Last Post: 01-15-2011, 10:13 PM
  4. Submit jsp form data to java
    By keanhoo168 in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 09-09-2010, 11:43 AM
  5. General Question about Java
    By bayan in forum New To Java
    Replies: 6
    Last Post: 05-26-2010, 11:16 AM

Posting Permissions

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