Javascript gallerie marche pas

Résolu/Fermé
yann5 Messages postés 398 Date d'inscription lundi 24 mars 2008 Statut Membre Dernière intervention 1 mai 2015 - 28 juil. 2010 à 13:54
avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 - 29 juil. 2010 à 22:13
Bonjour,


Voici mon script :

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript">
window.onload = "var photo = 1";
</script>

<script language="Javascript">

function verifPhoto(action) {

if (action=="suiv") {photo++; changePhoto();}
if (action=="prec") {photo--; changePhoto();}
}

function changePhoto() {
switch (photo) {
	
	case '1':
	document.getElementByName(photo).src ='http://wakstep.u7n.org/include/img/minis/frederic.JPG';
	document.getElementByName(photo).alt = 'Frédéric';
	break;
	
	default:
	document.getElementsByName(photo).src = 'http://wakstep.u7n.org/include/img/noimage.gif';
	document.getElementByName(photo).alt = 'Fin de liste';
	break;
	
} 


}
</script></head>
<table align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" colspan="2" height="22"><center>
<img name="photo" src="http://wakstep.u7n.org/include/img/minis/frederic.JPG" alt="Frédéric" />
</center>
</td>
</tr>
<tr>
	<td width="50%" nowrap><p align="left"><a href="#" onClick="verifPhoto('prec')"><font size='3' color='red'>Image Précédente</font></a></td>
	<td width="50%" nowrap><p align="right"><a href="#)" onClick="verifPhoto('suiv')"><font size='3' color='red'>Image Suivante</font></a></td>
</tr>
</table>



</body>
</html>


Et voici ma page de test : http://wakstep.u7n.org/?page=2


Vous voyez : ça ne marche pas !
Aidez-moi, merci !

2 réponses

yann5 Messages postés 398 Date d'inscription lundi 24 mars 2008 Statut Membre Dernière intervention 1 mai 2015 61
28 juil. 2010 à 20:38
Trouvé alternative, merci quand meme
0
avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 4 497
28 juil. 2010 à 21:06
Salut.

J'ai crus halluciner mais nan, c'est bien vrai :
Un doctype, une balise <html> et une balise <head> au beau milieu du <body> !
0
yann5 Messages postés 398 Date d'inscription lundi 24 mars 2008 Statut Membre Dernière intervention 1 mai 2015 61
29 juil. 2010 à 10:42
effectivement tu allucine
0
avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 4 497
29 juil. 2010 à 10:48
Nan nan j'ai bien raison :
http://www.cijoint.fr/cj201007/cijHqzmaYR.png
0
yann5 Messages postés 398 Date d'inscription lundi 24 mars 2008 Statut Membre Dernière intervention 1 mai 2015 61
29 juil. 2010 à 17:33
ah ouai c'est normal j'ai mis un include en php
0
avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 4 497
29 juil. 2010 à 22:13
Avec ou sans PHP, le code final est invalide.
0