Bonjour,
J'ai besoin de faire une recherche dans un tableau, donc voici le script que j'ai tapé:
Je ne comprends pas mon alert(javatabimg[j]);, qui me sort chaque lettre une a une de ma premiere entree de tableau ... Ne serais-je pas sensé avoir ../mesphotos/a.JPG ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 function Quelleimage(){ Photo = document.getElementById('Imencours').src;//m'affiche le chemin de ma photo en cours Photosanschemin = Photo.substring(Photo.lastIndexOf("/")+1);//m'affiche le nom de ma photo for(j=0; j<javatabimg.length; j++) // javatabimg = ("../mesphotos/a.JPG","../mesphotos/azeacerfd.JPG","../mesphotos/dhnjfhkuuuu.JPG","../mesphotos/IMG_7042.JPG"); {if(javatabimg[j].indexOf(Photosanschemin)){ if(javatabimg[j].indexOf(Photosanschemin)) {return j;} else {j="-1";} } alert(javatabimg[j]); }
Quelqu'un peu m'aider ?
J'en suis la :
Merci !!
Partager