Created
October 10, 2017 08:26
-
-
Save AladinDridi/e551742234cf9c1d3c8fc8cf9a38fae4 to your computer and use it in GitHub Desktop.
Revisions
-
AladinDridi created this gist
Oct 10, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,103 @@ <script> var textarray = [ "Question 1", "Question 2", "Question 3" // pas virgule aprés dernier champs du tableau // ]; function RndText() { var rannum= Math.floor(Math.random()*textarray.length); if(textarray[rannum]=="Question 1"){ document.getElementById('select1').style.display="initial"; document.getElementById('select2').style.display="none"; document.getElementById('select3').style.display="none"; } else if(textarray[rannum]=="Question 2"){ document.getElementById('select1').style.display="none"; document.getElementById('select2').style.display="initial"; document.getElementById('select3').style.display="none"; }else if (textarray[rannum]="Question 3"){ document.getElementById('select1').style.display="none"; document.getElementById('select2').style.display="none"; document.getElementById('select3').style.display="initial"; } } window.onload = function() { RndText();} </script> <style> .formpara{ margin-top:100px; } #select1,#select2,#select3,select, label , input,button,.choixmultiple,.titre3{ margin-left: 40px; display:block; } select{ width: 200px; } .titre3{ font-family: 'Cairo', serif,"verdana",sans-serif,cursive,monospace; } input[type="text"],button[type="submit"]{ width:auto; height: auto; } button[type="submit"]{ margin-top: 40px; background-color: cadetblue; } .formpara{ display: block; } @media (max-width:800px){ label , input,button,.choixmultiple,.titre3{ margin-left: auto; display:block; } } </style> <link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet"> <div class="formpara"> <meta charset="utf-8"/> <h2 class="titre3">Forum </h2> <br/> <form method="post"> <meta charset="utf-8"/> <label for="question1">question 1 :</label> <input type="text" required name="question1"/> <br/> <label for="question2">question 2 ?</label> <input type="text" required name="question2"/> <br/> <div id="select1" class="choixmultiple"> <label for="choices">choix 1 ?</label> <SELECT required name="choices"> <option value="valeur1"></option> <option value="valeur2"></option> <option value="valeur3"></option> </SELECT> </div> <div id="select2" class="choixmultiple"> <label for="choices2">choix2 ?</label> <SELECT required name="choices2"> <option value="valeur1"></option> <option value="valeur2"></option> <option value="valeur3"></option> </SELECT> </div> <div id="select3" class="choixmultiple"> <label for="choices3">choix 3 .</label> <SELECT required name="choices3"> <option value="valeur1"></option> <option value="valeur2"></option> <option value="valeur3"></option> </SELECT> </div> <br/> <button id="button" type="submit" class="btn btn-default">Valider </button> </form>