Bonjour, et merci pour votre aide.
Le problème
Problème javascript sur le site suivant développé en php, html et javascript. : mcc.lceg.net (site en développement.)
Une fois sur le site cliquez : "Ma cave (photos) - en travaux -", un popup s'ouvre avec une liste déroulante. Dans cette liste choisissez "champignons", une série de photos s'affiche.
En cliquant sur une photo, elle ouvre un autre popup avec un agrandissement de cette photo.
Le premier popup (avec la liste déroulante) se referme seul au bout de quelques minutes.
Je voudrais que le second popup se referme après une autre durée.
A noter que toute les photos agrandies s'ouvrent dans le même popup (target identique, une photo chasse l'autre)
Je n'arrive pas à implémenter cette fonctionnalité, soit ça ne marche pas soit ça ferme le premier popup.
Dans la console, j'ai ces messages:
Si je les comprend for bien, je ne vois pas pourquoi !ma_cave_photos.php:74 Uncaught ReferenceError: fenP1 is not defined
at ma_cave_photos.php:74:3
ma_cave_photos.php:86 Uncaught ReferenceError: fenP1 is not defined
at ma_cave_photos.php:86:3
ma_cave_photos.php:98 Uncaught ReferenceError: fenP1 is not defined
at ma_cave_photos.php:98:3
Le problème se situe dans cette fonction.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 function affichePhoto($nomP) { $cheminPhoto="DOCUMENTS/PHOTOS/"; $nomPhoto="$nomP.jpg"; $cheminNomPhoto=$cheminPhoto.$nomPhoto; $W=getimagesize($cheminNomPhoto)[0]; $H=getimagesize($cheminNomPhoto)[1]; $w=480; $h=$w*$W/$H; echo" <td class='td1Photos'> <div align='center'> "; ?> <a href=<?echo"$cheminNomPhoto";?> target="P1" class='' onclick="fenP1=window.open(this.href, 'P1', 'width=<?echo"$w";?>, height=<?echo"$h";?>, top=50, left=100, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=yes, status=no');"> <img class="photo240carréSurvol" title="Cliquez pour zoomer."src=<?echo"$cheminNomPhoto";?> alt=""> </a> <? echo" </div> </td> "; ?> <script> /*self.close();* Là ça marche ensuite non, fenP1 n'est pas reconnu */ fenP1.close(); /*setTimeout(self.close,5000);*/ </script> <? }
Ci-dessous tout le code pour l'affichage des photos.
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189 <? /******************************************************/ /*** photoChap1.html */ /******************************************************/ /*** BLOC D'ENTREE DU NOM DES PHOTOS SANS EXTENSION ***/ /*** ATTENTION les photos doivent avoir une extension .jpg /*** Cette extension sera ajouté après. ***/ /******************************************************/ /*** nombre de lignes actives *************************/ $nbLiAct=2; /*** ligne1 * le .jpg sera ajouté après. ***/ $P_L1=array('P6','P7','P8'); // nom des photos sans extension $ST_L1=array('06','07','08'); // texte des photos. /* ligne2 * le .jpg sera ajouté après. ***/ $P_L2=array('P9','P9','P9'); // nom des photos sans extension $ST_L2=array('09','09','09'); // texte des photos. /* ligne3 * le .jpg sera ajouté après. ***/ $P_L3=array('','',''); // nom des photos sans extension $ST_L3=array('','',''); // texte des photos. /* ligne4 * le .jpg sera ajouté après. ***/ $P_L4=array('','',''); // nom des photos sans extension $ST_L4=array('','',''); // texte des photos. /* ligne5 * le .jpg sera ajouté après. ***/ $P_L5=array('','',''); // nom des photos sans extension $ST_L5=array('','',''); // texte des photos. /**********************************************************/ /*** FIN BLOC D'ENTREE DU NOM DES PHOTOS SANS EXTENSION ***/ /**********************************************************/ /*** Rien n'est à modifier après ce bloc. *****************/ /**********************************************************/ function affichePhoto($nomP) { $cheminPhoto="DOCUMENTS/PHOTOS/"; $nomPhoto="$nomP.jpg"; $cheminNomPhoto=$cheminPhoto.$nomPhoto; $W=getimagesize($cheminNomPhoto)[0]; $H=getimagesize($cheminNomPhoto)[1]; $w=480; $h=$w*$W/$H; echo" <td class='td1Photos'> <div align='center'> "; ?> <a href=<?echo"$cheminNomPhoto";?> target="P1" class='' onclick="fenP1=window.open(this.href, 'P1', 'width=<?echo"$w";?>, height=<?echo"$h";?>, top=50, left=100, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=yes, status=no');"> <img class="photo240carréSurvol" title="Cliquez pour zoomer."src=<?echo"$cheminNomPhoto";?> alt=""> </a> <? echo" </div> </td> "; ?> <script> /*self.close();* Là ça marche ensuite non, fenP1 n'est pas reconnu */ fenP1.close(); /*setTimeout(self.close,5000);*/ </script> <? } function afficheST($STP) { ?> <tr class="trTextesTableV"> <td class="td1TexteG"><?echo"$STP[0]";?></td> <td class="td2TextesTableV"> </td> <td class="td1TexteG"><?echo"$STP[1]";?></td> <td class="td2TextesTableV"> </td> <td class="td1TexteG"><?echo"$STP[2]";?></td> </tr> <? } function espaceEntrePhotos() { echo"<td class='EspaceEntrePhotos'> </td>"; } function espaceEntreLignes() { echo"<td class='espaceV' colspan=''> </td>"; } ?> <table id="table_photos" class="dégradéMCC" title="photos"> <!-- *************** --> <!-- photosTest.html --> <!-- *************** --> <? if ($nbLiAct>=1) { ?> <!-- Ligne 1 --> <tr class="dégradéMCC_tr1"> <? affichePhoto($P_L1[0]); // Photo gauche espaceEntrePhotos(); affichePhoto($P_L1[1]); // Photo milieu espaceEntrePhotos(); affichePhoto($P_L1[2]); // photo droite afficheST($ST_L1); // textes sous photos ?> <td class="MargeD"> </td> </tr> <? espaceEntreLignes(); //FIN Ligne 1 } if ($nbLiAct>=2) { ?> <!-- Ligne 2 --> <tr class="dégradéMCC_tr1"> <? affichePhoto($P_L2[0]); // Photo gauche espaceEntrePhotos(); affichePhoto($P_L2[1]); // Photo milieu espaceEntrePhotos(); affichePhoto($P_L2[2]); // photo droite afficheST($ST_L2); // textes sous photos ?> <td class="MargeD"> </td> </tr> <? espaceEntreLignes(); //FIN Ligne 2 } if ($nbLiAct>=3) { ?> <!-- Ligne 3 --> <tr class="dégradéMCC_tr1"> <? affichePhoto($P_L3[0]); // Photo gauche espaceEntrePhotos(); affichePhoto($P_L3[1]); // Photo milieu espaceEntrePhotos(); affichePhoto($P_L3[2]); // photo droite afficheST($ST_L3); // textes sous photos ?> <td class="MargeD"> </td> </tr> <? espaceEntreLignes(); //FIN Ligne 3 } if ($nbLiAct>=4) { ?> <!-- Ligne 4 --> <tr class="dégradéMCC_tr1"> <? affichePhoto($P_L4[0]); // Photo gauche espaceEntrePhotos(); affichePhoto($P_L4[1]); // Photo milieu espaceEntrePhotos(); affichePhoto($P_L4[2]); // photo droite afficheST($ST_L4); // textes sous photos ?> <td class="MargeD"> </td> </tr> <? espaceEntreLignes(); //FIN Ligne 4 } if ($nbLiAct>=5) { ?> <!-- Ligne 5 --> <tr class="dégradéMCC_tr1"> <? affichePhoto($P_L5[0]); // Photo gauche espaceEntrePhotos(); affichePhoto($P_L5[1]); // Photo milieu espaceEntrePhotos(); affichePhoto($P_L5[2]); // photo droite afficheST($ST_L5); // textes sous photos ?> <td class="MargeD"> </td> </tr> <? espaceEntreLignes(); //FIN Ligne 5 } ?> </table> <!-- ******************* --> <!-- FIN photosTest.html --> <!-- ******************* -->
Ce code est inclu (include) à partir de la page de la liste déroulante
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 <body class="body_popup1" onload="window.resizeTo(800,800); setTimeout(window.close, <?echo"1.5*$mn10";?>)";> <!-- ferme au bout de 15 mn. --> <div id="HdP"></div> <!--- Table principale (id="tableP") --> <table id="tableEnTete_photos" class="tableEnTete_popup1 dégradéMCC" title="photos"> <tr class=""> <td align="center"> <div class="texteBase_MCC" style=""> <form method="post" id="choixR" name="choixR" action="#"> <label for="numPhotos">Les photos de </label> <select name="numPhotos" id="numPhotos" onChange="document.forms['choixR'].submit();"> <option value="99">Choisissez vos photos.</option> <option value="chap1">Champignons</option> <option value="chap2">Labos</option> <option value="chap3">Bizarre</option> <option value="test">Test</option> </select> <label for="numPhotos">Ma Cave à Champignons</label> </form> </div> </td> </tr> <? if ($numPhotos=="chap1") { include('pagesPHOTOS/photosChap1.html'); } elseif ($numPhotos=="chap2") { include('pagesPHOTOS/photosChap2.html'); } elseif ($numPhotos=="chap3") { include('pagesPHOTOS/photosChap3.html'); } elseif ($numPhotos=="test") { include('pagesPHOTOS/photosTest.html'); } ?> </table> </div> </body>
La console me signale aussi, mais c'est sans doute sans rapport :
Pourtant toute mes pages me semblent conforme :"One or more documents in this page is in Quirks Mode."
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 <!DOCTYPE html> <!--html 5--> <html lang="fr"> <head>
Merci pour vos futures réponses.
Partager