Accueil > > > JEUX DES PAIRES
JEUX DES PAIRES
Information sur la source
Description
C'est un de mes premier code en js, il montre les fonction et l'utilisation de pop up avec transfere pop vers page et page vers pop. il y a aussi un petit compteur en minute (j'avais pas encore trouver comment le fair en sec) a plus Eln
Source
- <html>
-
- <head>
- <title>-- Jeux par hennuy françois--</title>
-
- <SCRIPT LANGUAGE="javascript">
-
- tab = new Array (12);
- tab1 = new Array (12);
- tab2 = new Array (12);
-
- choix = "image";
- flag = 0;
- cpt = 0;
- cptj = 0;
- melangeok = 0;
- valeurtempsdepardM = 0;
- valeurtempsfinM = 0;
- variable_date = 0;
- tempsfinalM = 0;
-
- for( i=1 ; i<=12 ; i++)
- {
- choix = "image/1/";
- tab[i]= choix + i + ".jpg";
- }
-
-
- function init()
- {
- for(i=0 ; i<=11 ; i++)
- {
- /*document.images[i].src = tab[i]; */
- document.images[i].src = "blanc.jpg";
- }
-
- cpt = 0;
- cptj = 0;
- }
-
- function melange()
- {
- melangeok = 1;
-
- init();
-
- for (i=0 ; i<=12 ; i++)
- {
- tab1[i]= 0;
- }
-
- k = 0;
-
- while (k < 12 )
- {
-
- n = Math.round (11 * Math.random());
- n++;
-
- if (tab1[n] == 0)
- {
- choix = "image/1/";
- tab[k] = choix + n + ".jpg" ;
- tab2[k] = n;
- /* document.images[k].src = tab[k] ; */
- tab1[n] = 1 ;
- k++;
- }
- }
- }
-
- function affiche(n)
- {
- if (melangeok == 1)
- {
-
- document.images[n].src = tab[n];
-
- if ( flag == 0 )
- {
- a = tab2[n];
- n1 = n;
- }
-
- if ( flag == 1 )
- {
- b = tab2[n];
- n2 = n;
- flag = -1;
- cmp(a,b,n1,n2);
- }
-
- flag++;
-
- }
- else
- {
- alert ("Enregistrer vous pour jouer");
- }
-
- }
-
-
- function cmp(a,b,n1,n2)
- {
- if (a == b )
- {
- alert ("pas deux foi la meme image");
- }
-
- if ( (a == (b - 6)) || ((a - 6) == b) )
- {
- cptj++;
- cpt++;
- }
- else
- {
- alert("recommencer");
- document.images[n1].src = "blanc.jpg";
- document.images[n2].src = "blanc.jpg";
- cpt++;
- }
- if (cptj == 6 )
- {
- temps();
- tempsfinalM = ( valeurtempsfinM - valeurtempsdepardM );
- pop_up2(cpt);
- melangeok = 0;
- valeurtempsdepardM = 0;
- }
- }
-
- function pop_on()
- {
- window.open('pop.html','nom_doc','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=200,height=150,top=100,left=400');
- }
-
- function pop_up2(cpt)
- {
- n_fen = window.open('pop2.html','nom_doc','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=200,height=150,top=100,left=400');
- nom = document.initial.nom.value;
-
- if (nom == "")
- {
- nom = "X";
- n_fen.document.write("<body bgcolor='#cccccc'><center>" + "Bonjour " + nom + " vous devez vous enregistrez" + " <br><br><input type=button value='Fermer' onclick='self.close()'></center></body>");
- }
- else
- {
- n_fen.document.write("<body bgcolor='#cccccc'><center>" + "Bonjour " + nom + " vous avez réussi en : " + cpt + " coups et en " + tempsfinalM + " Minute(s)" + " <br><br><input type=button value='Fermer' onclick='self.close()'></center></body>");
- melange();
- document.initial.nom.value = "";
- }
- }
-
- function temps()
- {
-
- variable_date = new Date();
-
- if (valeurtempsdepardM == 0 )
- {
- valeurtempsdepardM = variable_date.getMinutes();
- }
- else
- {
- valeurtempsfinM = variable_date.getMinutes();
- }
- }
-
- </script>
-
- </head>
-
- <body bgcolor="#cccccc" onload="init()">
-
- <table width = 300 height = 450 border = 0 cellspacing = 0 align = center >
-
- <tr>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(0)"></div></td>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(1)"></div></td>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(2)"></div></td>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(3)"></div></td>
- </tr>
-
- <tr>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(4)"></div></td>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(5)"></div></td>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(6)"></div></td>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(7)"></div></td>
- </tr>
-
- <tr>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(8)"></div></td>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(9)"></div></td>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(10)"></div></td>
- <td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(11)"></div></td>
- </tr>
-
- </table>
-
- <br>
-
- <form name="initial">
-
- <div align="center" class="Style2">
- Votre nom est <input type="text" name="nom" value="" disabled>
- </div>
-
- <br>
-
- <div align="center">
- <input type=button name="bouton2" value="S'enregistrer" onclick="pop_on();melange();temps()">
- </div>
-
- </form>
-
- </body>
-
- </html>
<html>
<head>
<title>-- Jeux par hennuy françois--</title>
<SCRIPT LANGUAGE="javascript">
tab = new Array (12);
tab1 = new Array (12);
tab2 = new Array (12);
choix = "image";
flag = 0;
cpt = 0;
cptj = 0;
melangeok = 0;
valeurtempsdepardM = 0;
valeurtempsfinM = 0;
variable_date = 0;
tempsfinalM = 0;
for( i=1 ; i<=12 ; i++)
{
choix = "image/1/";
tab[i]= choix + i + ".jpg";
}
function init()
{
for(i=0 ; i<=11 ; i++)
{
/*document.images[i].src = tab[i]; */
document.images[i].src = "blanc.jpg";
}
cpt = 0;
cptj = 0;
}
function melange()
{
melangeok = 1;
init();
for (i=0 ; i<=12 ; i++)
{
tab1[i]= 0;
}
k = 0;
while (k < 12 )
{
n = Math.round (11 * Math.random());
n++;
if (tab1[n] == 0)
{
choix = "image/1/";
tab[k] = choix + n + ".jpg" ;
tab2[k] = n;
/* document.images[k].src = tab[k] ; */
tab1[n] = 1 ;
k++;
}
}
}
function affiche(n)
{
if (melangeok == 1)
{
document.images[n].src = tab[n];
if ( flag == 0 )
{
a = tab2[n];
n1 = n;
}
if ( flag == 1 )
{
b = tab2[n];
n2 = n;
flag = -1;
cmp(a,b,n1,n2);
}
flag++;
}
else
{
alert ("Enregistrer vous pour jouer");
}
}
function cmp(a,b,n1,n2)
{
if (a == b )
{
alert ("pas deux foi la meme image");
}
if ( (a == (b - 6)) || ((a - 6) == b) )
{
cptj++;
cpt++;
}
else
{
alert("recommencer");
document.images[n1].src = "blanc.jpg";
document.images[n2].src = "blanc.jpg";
cpt++;
}
if (cptj == 6 )
{
temps();
tempsfinalM = ( valeurtempsfinM - valeurtempsdepardM );
pop_up2(cpt);
melangeok = 0;
valeurtempsdepardM = 0;
}
}
function pop_on()
{
window.open('pop.html','nom_doc','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=200,height=150,top=100,left=400');
}
function pop_up2(cpt)
{
n_fen = window.open('pop2.html','nom_doc','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=200,height=150,top=100,left=400');
nom = document.initial.nom.value;
if (nom == "")
{
nom = "X";
n_fen.document.write("<body bgcolor='#cccccc'><center>" + "Bonjour " + nom + " vous devez vous enregistrez" + " <br><br><input type=button value='Fermer' onclick='self.close()'></center></body>");
}
else
{
n_fen.document.write("<body bgcolor='#cccccc'><center>" + "Bonjour " + nom + " vous avez réussi en : " + cpt + " coups et en " + tempsfinalM + " Minute(s)" + " <br><br><input type=button value='Fermer' onclick='self.close()'></center></body>");
melange();
document.initial.nom.value = "";
}
}
function temps()
{
variable_date = new Date();
if (valeurtempsdepardM == 0 )
{
valeurtempsdepardM = variable_date.getMinutes();
}
else
{
valeurtempsfinM = variable_date.getMinutes();
}
}
</script>
</head>
<body bgcolor="#cccccc" onload="init()">
<table width = 300 height = 450 border = 0 cellspacing = 0 align = center >
<tr>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(0)"></div></td>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(1)"></div></td>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(2)"></div></td>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(3)"></div></td>
</tr>
<tr>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(4)"></div></td>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(5)"></div></td>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(6)"></div></td>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(7)"></div></td>
</tr>
<tr>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(8)"></div></td>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(9)"></div></td>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(10)"></div></td>
<td><div align="center"><img src="blanc.jpg" width="100" height="150" OnClick="affiche(11)"></div></td>
</tr>
</table>
<br>
<form name="initial">
<div align="center" class="Style2">
Votre nom est <input type="text" name="nom" value="" disabled>
</div>
<br>
<div align="center">
<input type=button name="bouton2" value="S'enregistrer" onclick="pop_on();melange();temps()">
</div>
</form>
</body>
</html>
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
[DESIGN PATTERNS] PARTIE 2: DIP: DEPENDENCY INVERSION PRINCIPLE[DESIGN PATTERNS] PARTIE 2: DIP: DEPENDENCY INVERSION PRINCIPLE par tja
C'est le dernier principe des principes du Design Orienté Objet (The Principles of Object Oriented Design) fondés par Robert C. Martin plus connu sous le pseudonyme d'Uncle Bob.
l'image empruntée de LosTechies.
Je ne traite pas les principes dans...
Cliquez pour lire la suite de l'article par tja TECHDAYS PARIS 2010 : SHAREPOINT 2010 POUR LES DéVELOPPEURSTECHDAYS PARIS 2010 : SHAREPOINT 2010 POUR LES DéVELOPPEURS par ROMELARD Fabrice
Animé par: Laurent Cotton Le développement dans SharePoint 2010 passe par plusieurs axes qui seront évoqués dans cette session, mais plus particulièrement les développements simples lié au besoin Business Business Connectivity Services Ce BCS es...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2010 : PLEINIèRE DERNIER JOURTECHDAYS PARIS 2010 : PLEINIèRE DERNIER JOUR par ROMELARD Fabrice
Cette session est la dernière pleinière de ces 3 jours de TechDays Paris 2010. Généralement, cette troisième journée est plus axée sur l'avenir vu par Microsoft. Après un retour sur l'avenir vu par la Science Fiction ou par ...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice UNE JOLIE-HORLOGE ET PAS QU'UN PEU !UNE JOLIE-HORLOGE ET PAS QU'UN PEU ! par neodante
Pour les possesseurs d'iPhone, ça y est Bijin Tokei - qui se traduit littéralement en Français par " Jolie Horloge " - est arrivé et GRATUITEMENT s'il vous plaît ! Après la version Tokyo, Hokkaido, night club, racing, Gal, "pour les mademoiselles'", . voi...
Cliquez pour lire la suite de l'article par neodante TECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICESTECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICES par ROMELARD Fabrice
Animé par: Gaetan Bouveret et Julien Chomarat Business Connectivity Services (BCS) est dans SharePoint 2010 la version 2 de Business Data Catalog (BDC dans SharePoint 2007). Il s'agit de la solution permettant de visualiser des données provenan...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
|