Spick V2
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.



 
AccueilPortailRechercherDernières imagesS'enregistrerConnexion
-15%
Le deal à ne pas rater :
(Adhérents Fnac) LEGO® Star Wars™ 75367 Le croiseur d’assaut de ...
552.49 € 649.99 €
Voir le deal

 

 Quiz pour vos sites

Aller en bas 
AuteurMessage
Spick
Administrateur
Administrateur
Spick


Nombre de messages : 462
Date d'inscription : 10/02/2008

Quiz pour vos sites Empty
MessageSujet: Quiz pour vos sites   Quiz pour vos sites I_icon_minitimeLun 18 Fév - 0:45

Le code pour mettre un quiz dans vos pages:

Citation :
<script>

//script nicolas (nicolas@abacho.fr)


var ans = new Array;
var done = new Array;
var score = 0;


ans[1] = "#";
ans[2] = "#";
ans[3] = "#";
ans[4] = "#";
ans[5] = "#";
ans[6] = "#";
ans[7] = "#";
ans[8] = "#";
ans[9] = "#";
ans[10] = "#";

function Engine(question, answer) {

if (answer != ans[question]) {
if (!done[question]) {
done[question] = -1;
alert("Faux, votre score: " + score);
}
else {
alert("Vous avez déjà répondu");
}
}
else {
if (!done[question]) {
done[question] = -1;
score++;
alert("Bonne réponse, score " + score);
}
else {
alert("Vous avez déjà répondu");
}
}
}

function NextLevel () {
if (score > 10) {
alert("Cheater!");
}
if (score >= 7 && score <= 11) {
alert("Bravo")

}
else {
alert("Pas terrible!")
}
}


</script>

<center><font size=6 face=Arial>Quiz</font><br>
</center>
<noscript>JavaScript is <b><i>disabled</b></i>. Get Netscape 3.0 or turn it on!</noscript>

<form>
1.<p>
<input type=radio value="a" onClick="Engine(1, this.value)"><br>
<input type=radio value="b" onClick="Engine(1, this.value)"><br>
<input type=radio value="c" onClick="Engine(1, this.value)"><br>
<input type=radio value="d" onClick="Engine(1, this.value)"><p>

2.<p>
<input type=radio value="a" onClick="Engine(2, this.value)"><br>
<input type=radio value="b" onClick="Engine(2, this.value)"><br>
<input type=radio value="c" onClick="Engine(2, this.value)"><br>
<input type=radio value="d" onClick="Engine(2, this.value)"><p>

3.<p>
<input type=radio value="a" onClick="Engine(3, this.value)"><br>
<input type=radio value="b" onClick="Engine(3, this.value)"><br>
<input type=radio value="c" onClick="Engine(3, this.value)"><br>
<input type=radio value="d" onClick="Engine(3, this.value)"><p>

4.<p>
<input type=radio value="a" onClick="Engine(4, this.value)"><br>
<input type=radio value="b" onClick="Engine(4, this.value)"><br>
<input type=radio value="c" onClick="Engine(4, this.value)"><br>
<input type=radio value="d" onClick="Engine(4, this.value)"><p>

5.<p>
<input type=radio value="a" onClick="Engine(5, this.value)"><br>
<input type=radio value="b" onClick="Engine(5, this.value)"><br>
<input type=radio value="c" onClick="Engine(5, this.value)"><br>
<input type=radio value="d" onClick="Engine(5, this.value)"><p>

6.<p>
<input type=radio value="a" onClick="Engine(6, this.value)"><br>
<input type=radio value="b" onClick="Engine(6, this.value)"><br>
<input type=radio value="c" onClick="Engine(6, this.value)"><br>
<input type=radio value="d" onClick="Engine(6, this.value)"><p>

7.<p>
<input type=radio value="a" onClick="Engine(7, this.value)"><br>
<input type=radio value="b" onClick="Engine(7, this.value)"><br>
<input type=radio value="c" onClick="Engine(7, this.value)"><br>
<input type=radio value="d" onClick="Engine(7, this.value)"><p>

8.<p>
<input type=radio value="a" onClick="Engine(8, this.value)"><br>
<input type=radio value="b" onClick="Engine(8, this.value)"><br>
<input type=radio value="c" onClick="Engine(8, this.value)"><br>
<input type=radio value="d" onClick="Engine(8, this.value)"><p>

9.<p>
<input type=radio value="a" onClick="Engine(9, this.value)"><br>
<input type=radio value="b" onClick="Engine(9, this.value)"><br>
<input type=radio value="c" onClick="Engine(9, this.value)"><br>
<input type=radio value="d" onClick="Engine(9, this.value)"><p>

10.<p>
<input type=radio value="a" onClick="Engine(10, this.value)"><br>
<input type=radio value="b" onClick="Engine(10, this.value)"><br>
<input type=radio value="c" onClick="Engine(10, this.value)"><br>
<input type=radio value="d" onClick="Engine(10, this.value)"><p>

<center>
<input type=button onClick="NextLevel()" value="Résultat">
</center>
</form>
<!-- END OF SCRIPT -->

Explication:
Mettons que pour la question 1, la bonne réponse est "C", Mettre dans le javascript :

ans[1] = "c"; //la réponse de la question 1 est "c" comme indiqué dans le js
ans[2] = "#";//faire de même avec les autres questions
ans[3] = "#";
ans[4] = "#";
ans[5] = "#";
ans[6] = "#";
ans[7] = "#";
ans[8] = "#";
ans[9] = "#";
ans[10] = "#";

Faire de même avec les autres questions

Pour mettre la question il faut sortir de la source et taper sont texte directement sur le quiz
Revenir en haut Aller en bas
 
Quiz pour vos sites
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Mini chat pour vos sites
» Script pour calculer
» pour mon logo
» Slogan pour F2O (fait)

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Spick V2 :: Libre Service :: Scripts-
Sauter vers:  
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser