SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Urgent Code Plz

Hybrid View

  1. #1
    SitePoint Addict einSTein's Avatar
    Join Date
    Aug 2006
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Urgent Code Plz

    i need to make a validation form like that sends the answers of this form to a javascript function to validate the answer and calulate the score , i made the dorm but i want to know how to send the values to the function script and i want to know to how to make the function calculate the score
    Code HTML4Strict:
    <form action="" method="POST">
                  <p> <span class="style2">1. <strong>What is a fact? </strong>
                  <br>
                  <input type="radio" name="question1" value=1> 
                 A term followed by a period.<br>
                  <input type="radio" name="question1" value=2> 
                 A term. <br>
                  <input type="radio" name="question1" value=3> 
                   structure followed by a period.
     
              </span>
                <p class="style2"> 2. <strong>Can the term in a fact be a variable? </strong><br>
    <input type="radio" name="question2" value=1 > Yes<br>
    <input type="radio" name="question2" value=2>No              
                  <p class="style2"> 3. <strong>Which of the following is not a query?</strong><br>
    <input type="radio" name="question3" value=1 >?- student(Lisa, X). <br>
    <input type="radio" name="question3" value=2>?- student(Abraham, X).<br> 
    <input type="radio" name="question3" value=3>  student(Abraham, X).
                  <p class="style2"> 4. <strong>Can a query be made up of more than one subgoal? </strong><br>
    <input type="radio" name="question4" value=1>Yes<br>
    <input type="radio" name="question4" value=2> No
                  <p class="style2"> 5. <strong>Which of the following is not a variable?</strong><br>
    <input type="radio" name="question5" value=1> glyph <br>
    <input type="radio" name="question5" value=2> _glyph<br>
    <input type="radio" name="question5" value=3>g_lobal .<br>
    <input type="radio" name="question5" value=4> c_3<br> 
    <input type="radio" name="question5" value=5>c3 
                  <p class="style2"> 6. <strong>What is a free variable? </strong><br>
    <input type="radio" name="question6" value=1>A variable which has not been given a value.<br>
    <input type="radio" name="question6" value=2>A variable which has been given a value.<br><br>
    <input name="Submit Quiz" type="button" value="Show Result"  onclick=javascript:value(question1.value,'1',question2.value,"2")>
    <input type="reset" name="Reset">
    </form>

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Manchester, UK
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form submission to JS

    Hi,

    You can put an onSubmit handler in your form tag, with a return false statement directly after it similar to this:

    Code:
    onSubmit="jsFunc();return false;"
    You will need to add a submit button to the form if it doesnt already have one.


Bookmarks

Posting Permissions

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