Test de QI
Répondre à la discussion
Affichage des résultats 1 à 12 sur 12

Test de QI



  1. #1
    titoumic

    Test de QI


    ------

    Bonjour, je dois creer un mini test de QI, j ai reussi a creer les questions avec le code suivant mais je na rrive pas a synchroniser avec le bouton "submit".
    il faut que lorsque j appuie sur le bouton submit il y ait un message me donnant mon pourcentage de reussite, savez vous ce aue je dois modifier dans mon code pour qu il fonctionne s il vous plait ???? merci !

    Code HTML:
    <html>
     <head>
     <title>Test page</title>
     <script language="JavaScript">
     function score(){
     var score=0;
     if (document.myform.r1[1].checked == true)
     score++;
     if (document.myform.r2[0].checked == true)
     score++;
     if (document.myform.r3[0].checked == true)
     score++;
     if (document.myform.r4[3].checked == true)
     score++;
     if (document.myform.r5[2].checked == true)
     score++;
     
    window.alert("Your score is: " + score);
     }
     
    </script>
     </head>
     <body>
     <h1><center>IQ test</center></h1>
     <form name = "myform">
     
    
    <td valign="top">1.</td>
     What is the name of the first US's president:<br> 
    Franklin D.Roosevelt<input type = radio name = r1 value =1 checked><br> 
    George Washington<input type = radio name = r1 value = 2><br>
     Thomas Jefferson <input type = radio name = r1 value = 3><br><br>
     
    <td valign="top">2.</td>
     Which number should come next in the series ?<br> 
    5-10-15-20
     <br>
     <br>
     25<input type = radio name = r2 value = 1 checked><br> 
    26<input type = radio name = r2 value = 2><br>
     30<input type = radio name = r2 value = 3><br>
     
    
    <br>
     
    <td valign="top">3.</td>
     
    "In this world nothing can be said to be certain, except death and taxes." This statement was made by Benjamin Franklin.
     <br/>
     <br/>
     <input type = radio name = r3 value =1 checked>True
     <input type = radio name = r3 value =2>False
     
    
    
    <br>
     <td valign="top">4.</td>
     Which one of the five choices makes the best comparison?<br>WATCH is to HCTAW as 46251 is to:</td></tr><br>
     <br>
     <input type = radio name = r4 value =1>25641<br>
     <input type = radio name = r4 value=2>12654<br>
     <input type = radio name = r4 value=3>51462<br> <input type = radio name = r4 value=4 checked>15264
     
    <br>
     
    <br>
     <td valign="top">5.</td>
     Forest is to tree as tree is to?<br>
     <br>
     
    <button class ='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' = radio name = r5 value =1>Plant</button>
     <br>
     <button class='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' = radio name = r5 value =2>Branch</button>
     <br>
     <button class='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' = radio name = r5 value=3 checked>Leaf</button>
     <br>
     <button class='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' = radio name = r5 value =4>Mangrove</button>
     
    
    <br>
     
    <br>
     <td valign="top">6.</td>
     The day after the day after tomorrow is four days before Monday. What day is it today ?<br>
     
    <SELECT NAME="answer1" SIZE=1>
     <OPTION SELECTED VALUE="0">-- Choose the correct answer -- 
    <OPTION VALUE="1">Tuesday
     <OPTION VALUE="2">Monday
     <OPTION VALUE="1">Wednesday
     <OPTION VALUE="1">Thursday
     </SELECT> 
    
    <br>
     <input type = "button" value = "Submit" onclick = "score()">
     <br>
     
    
    </form>
     </body></html>

    -----
    Dernière modification par JPL ; 10/12/2014 à 13h36. Motif: Ajout de la balise HTML

  2. #2
    Pauldair

    Re : Test de QI

    Bonjour,

    J'ai un peu de mal avec ta syntaxe ici:

    Code:
    <button class ='btn btn-test btn-test-warning btn-block btn-test-2-lines next_view' = radio name = r5 value =1>Plant</button>
    deux "=" qui se suivent, je ne comprends pas. Il manque quelque chose, non ?

    Cordialement.

  3. #3
    titoumic

    Re : Test de QI

    Bonjour,
    Je vous avoue que je ne suis pas tres habile en code et je n arrive pas a corriger mes erreurs, d'ou mon message

  4. #4
    Lomic2

    Re : Test de QI

    il manque "type"
    type="radio"

  5. A voir en vidéo sur Futura
  6. #5
    titoumic

    Re : Test de QI

    Merci Lomic mais ca ne fonctionne toujours pas, et ma question de base est comment synchroniser les questions avec le bouton submit pour avoir un pourcentage de reponse :/

  7. #6
    minushabens

    Re : Test de QI

    A une époque je maintenais le site de mon labo et j'utilisais cette page : http://validator.w3.org/ pour vérifier la syntaxe de mes xml.

  8. #7
    Lomic2

    Re : Test de QI

    en fait il y a beaucoup de choses à corriger dans la structure de la page, tu devrais mettre des " autour de toutes tes valeurs, ex :
    Code HTML:
    <input type="radio" name="r3" value="1" checked>
    il traîne des bouts de structure de tableau : <td>

    pourquoi les réponses sont pré-cochées? (checked)

    je te mets une "petite" liste :

    Found 1 errors 96 warnings
    line 96 column 5 - Error: discarding unexpected </form>
    line 1 column 1 - Warning: missing <!DOCTYPE> declaration
    line 25 column 7 - Warning: <center> isn't allowed in <h1> elements
    line 26 column 7 - Warning: discarding unexpected </center>
    line 27 column 5 - Warning: missing </form> before <td>
    line 28 column 7 - Warning: inserting implicit <table>
    line 28 column 7 - Warning: missing <tr>
    line 29 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 29 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 30 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 30 column 7 - Warning: <input> isn't allowed in <tr> elements
    line 31 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 32 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 32 column 7 - Warning: <input> isn't allowed in <tr> elements
    line 33 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 34 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 34 column 7 - Warning: <input> isn't allowed in <tr> elements
    line 35 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 36 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 38 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 38 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 39 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 39 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 40 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 41 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 41 column 7 - Warning: <input> isn't allowed in <tr> elements
    line 42 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 43 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 43 column 7 - Warning: <input> isn't allowed in <tr> elements
    line 44 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 45 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 45 column 7 - Warning: <input> isn't allowed in <tr> elements
    line 46 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 47 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 49 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 49 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 50 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 51 column 7 - Warning: <input> isn't allowed in <tr> elements
    line 52 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 52 column 7 - Warning: <input> isn't allowed in <tr> elements
    line 53 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 53 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 55 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 55 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 55 column 11 - Warning: plain text isn't allowed in <tr> elements
    line 55 column 44 - Warning: discarding unexpected </td>
    line 57 column 7 - Warning: <br> isn't allowed in <table> elements
    line 58 column 7 - Warning: <br> isn't allowed in <table> elements
    line 59 column 7 - Warning: <input> isn't allowed in <table> elements
    line 60 column 7 - Warning: plain text isn't allowed in <table> elements
    line 60 column 7 - Warning: <br> isn't allowed in <table> elements
    line 61 column 7 - Warning: <input> isn't allowed in <table> elements
    line 62 column 7 - Warning: plain text isn't allowed in <table> elements
    line 62 column 7 - Warning: <br> isn't allowed in <table> elements
    line 63 column 7 - Warning: <input> isn't allowed in <table> elements
    line 64 column 7 - Warning: plain text isn't allowed in <table> elements
    line 64 column 7 - Warning: <br> isn't allowed in <table> elements
    line 65 column 7 - Warning: <input> isn't allowed in <table> elements
    line 66 column 7 - Warning: plain text isn't allowed in <table> elements
    line 66 column 7 - Warning: <br> isn't allowed in <table> elements
    line 67 column 7 - Warning: <br> isn't allowed in <table> elements
    line 68 column 7 - Warning: missing <tr>
    line 69 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 69 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 70 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 71 column 7 - Warning: <button> unexpected '=', expected attribute name
    line 71 column 7 - Warning: <button> isn't allowed in <tr> elements
    line 73 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 73 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 74 column 7 - Warning: <button> unexpected '=', expected attribute name
    line 74 column 7 - Warning: <button> isn't allowed in <tr> elements
    line 76 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 76 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 77 column 7 - Warning: <button> unexpected '=', expected attribute name
    line 77 column 7 - Warning: <button> isn't allowed in <tr> elements
    line 79 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 79 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 80 column 7 - Warning: <button> unexpected '=', expected attribute name
    line 80 column 7 - Warning: <button> isn't allowed in <tr> elements
    line 82 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 82 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 83 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 85 column 7 - Warning: plain text isn't allowed in <tr> elements
    line 85 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 86 column 7 - Warning: <select> isn't allowed in <tr> elements
    line 93 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 94 column 7 - Warning: <input> isn't allowed in <tr> elements
    line 95 column 7 - Warning: <br> isn't allowed in <tr> elements
    line 28 column 7 - Warning: missing </table> before </body>
    line 27 column 5 - Warning: missing </form>
    line 27 column 5 - Warning: <form> lacks "action" attribute
    line 71 column 7 - Warning: <button> proprietary attribute "radio"
    line 74 column 7 - Warning: <button> proprietary attribute "radio"
    line 77 column 7 - Warning: <button> proprietary attribute "radio"
    line 77 column 7 - Warning: <button> proprietary attribute "checked"
    line 80 column 7 - Warning: <button> proprietary attribute "radio"
    line 24 column 9 - Warning: trimming empty <h1>

  9. #8
    titoumic

    Re : Test de QI

    Merci c est gentil mais je ne sais pas du tout comment m en sortir avec ca malheureusement ...

  10. #9
    Lomic2

    Re : Test de QI

    En ouvrant un bouquin ou un site pour apprendre le HTML, ça n'est pas très compliqué. Je ne sais pas si tu trouveras quelqu'un ici pour coder à ta place.

  11. #10
    Pauldair

    Re : Test de QI

    Comment veux-tu que ton script fonctionne si toute la structure de ta page est incorrecte ?

    Javascript et moi-même n'y retrouvons pas nos petits. Lomic t'a mis la liste des erreurs, corrige les.

    Cordialement.

  12. #11
    Lomic2

    Re : Test de QI

    Allez je suis de bonne humeur/en manque de distraction :
    Code HTML:
    <!DOCTYPE HTML>
    <html>
    
    <head>
            <title>Test de QI</title>
            <meta charset="utf-8">
            <meta name="description" content="165c. uniques">
    </head>
    
    <body>
        <div id="page">
        <!-- DIV : Aucun sens semantique - zone geographique -->
        
            <header><!-- Entete de la zone consideree --></header>
            <nav><!-- Nav. principale de la page -> site --></nav>        
            <aside><!-- Les a-cotes de la page --></aside>
            <article><!-- Contenu textuel de la page -->
            <h1>IQ test</h1>
              <form name= "myform">
                1. What is the name of the first US's president : <br />
                <input type="radio" name="r1" value="1"> Franklin D.Roosevelt <br />
                <input type="radio" name="r1" value="2"> George Washington<br />
                <input type="radio" name="r1" value="3"> Thomas Jefferson<br />
                <br />
                2. Which number should come next in the series 5-10-15-20?<br />
                <input type="radio" name="r2" value="1">25<br />
                <input type="radio" name="r2" value="2">26<br />
                <input type="radio" name="r2" value="3">30<br />
                <br />
                3. &laquo;In this world nothing can be said to be certain, except death and taxes.&raquo; This statement was made by Benjamin Franklin. <br />
                <input type="radio" name="r3" value="1">True<br /> 
                <input type="radio" name="r3" value="2">False<br /> 
                <br />
                4. Which one of the five choices makes the best comparison? WATCH is to HCTAW as 46251 is to:<br />
                <input type="radio" name="r4" value="1">25641<br />
                <input type="radio" name="r4" value="2">12654<br />
                <input type="radio" name="r4" value="3">51462<br /> 
                <input type="radio" name="r4" value="4">15264<br />
                <br />
                5. Forest is to tree as tree is to?<br />
                <input type="radio" name="r5" value="1">Plant<br />
                <input type="radio" name="r5" value="2">Branch<br />
                <input type="radio" name="r5" value="3">Leaf<br />
                <input type="radio" name="r5" value="4">Mangrove<br />
                <br />
                6. The day after the day after tomorrow is four days before Monday. What day is it today ?<br />
                <input type="radio" name="r6" value="1">Tuesday<br />  
                <input type="radio" name="r6" value="2">Monday<br />
                <input type="radio" name="r6" value="3">Wednesday<br />
                <input type="radio" name="r6" value="4">Thursday<br />
                <br />
                <input type="button" value="Submit" onclick="score()">
                <br />
              </form>
            
            
            </article>
            <footer><!-- Pied-de-page de la page -> site --></footer>
            
        </div>
        <script>
            function score(){
            var score=0;
            if (document.myform.r1[1].checked == true)
            score++;
            if (document.myform.r2[0].checked == true)
            score++;
            if (document.myform.r3[0].checked == true)
            score++;
            if (document.myform.r4[3].checked == true)
            score++;
            if (document.myform.r5[2].checked == true)
            score++;
            if (document.myform.r6[1].checked == true)
            score++;
            window.alert("Your score is: " + score + "/6");
            }
        </script>
    
    </body>
    </html>
    (c'est du HTML5)

  13. #12
    Bluedeep

    Re : Test de QI

    Citation Envoyé par titoumic Voir le message
    Bonjour,
    Je vous avoue que je ne suis pas tres habile en code et je n arrive pas a corriger mes erreurs, d'ou mon message
    Le problème n'est pas (a priori) dans le code javascript mais dans le HTML (qui est tout pourri : tags TD & TR dont on se demande ce qu'ils font là, tags BR non fermés, etc ...).

Discussions similaires

  1. Test : un autre test gauche droite
    Par invite4dfd9275 dans le forum Psychologies (archives)
    Réponses: 3
    Dernier message: 14/03/2012, 21h07
  2. test de substitution au test test de Mc Nemar
    Par invite0fa80561 dans le forum Mathématiques du supérieur
    Réponses: 4
    Dernier message: 13/08/2009, 00h52
  3. test post hoc aprés un test de kruskal-Wallis
    Par invite92448e8a dans le forum Mathématiques du supérieur
    Réponses: 4
    Dernier message: 10/06/2009, 01h26
  4. génétique-Test d'identité / Test de paternité
    Par invite8056a839 dans le forum Biologie
    Réponses: 0
    Dernier message: 26/12/2006, 08h37