begin process at 2012 05 28 14:19:52
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Jeux

 > PETIT QUIZ

PETIT QUIZ


 Information sur la source

Note :
1 / 10 - par 1 personne
1,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Jeux Niveau :Initié Date de création :01/05/2003 Date de mise à jour :01/05/2003 15:00:02 Vu :8 045

Auteur : Nicoboss

Ecrire un message privé
Site perso
Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note

 Description

Petit quiz avec 10 questions et résultat

Source

  • <html>
  • <head>
  • <title>GameQuiz</title>
  • <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>
  • <BODY BGCOLOR="#FFFFFF">
  • <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 -->
  • </body>
  • </html>
<html>
<head>
<title>GameQuiz</title>

<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>
<BODY BGCOLOR="#FFFFFF">
<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 -->


</body>
</html> 

 Conclusion

Explications :

Trouvez ces lignes :

1.QUESTION A POSER&lt;p&gt;
&lt;input type=radio value="a" onClick="Engine(1, this.value)"&gt;REPONSE A&lt;br&gt;
&lt;input type=radio value="b" onClick="Engine(1, this.value)"&gt;REPONSE B&lt;br&gt;
&lt;input type=radio value="c" onClick="Engine(1, this.value)"&gt;REPONSE C&lt;br&gt;
&lt;input type=radio value="d" onClick="Engine(1, this.value)"&gt;REPONSE D&lt;p&gt;

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


 Sources du même auteur

UNE LISTE GÉRÉE PAR COOKIES
Source avec Zip Source avec une capture PRELOAD D'UNE PAGE AVEC BARRE DE PROGRESSION
NOTATION DE SITES
Source avec Zip CRÉATEUR SIMPLE DE PAGE WEB (EN ANGLAIS)
Source avec Zip PETIT SCRIPT DU GENRE MOTEUR DE RECHERCHE AVEC MOTS-CLÉS, NO...

 Sources de la même categorie

Source avec Zip Source avec une capture AVVDA : A VERY VERY DARK AFFAIRES DEMO par Cyreb
Source avec Zip Source avec une capture 3D AVEC WEBGL + MESH par Hakumbaya
SUDOKU RESOLVER (BRUTEFORECE, RÉCURSION) par amezghal
Source avec Zip MACHINE À SOUS par loicseg
Source avec Zip DOODLE JUMP EN JAVASCRIPT par Toshy62

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,624 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales