érreur de javasscript du diaporama

will.smith Messages postés 230 Date d'inscription   Statut Membre Dernière intervention   -  
will.smith Messages postés 230 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

j'ai fais cette diaporama :

http://www.editeurjavascript.com/scripts/scripts_images_2_3.php

et j'ai voulu supprimé suivant et précedent et j'ai voulu mettre des chiffres comme si on veux voir la photo 40 on cliqueras sur 40 au lieu de faire précedent à chaque fois

donc voilà le code :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Exemple diaporama</title>
</head>

<body>
<DIV ID=ejs_photo_box></div>
<SCRIPT LANGUAGE=JavaScript>
ejs_photo = new Array;
ejs_photo[0] = 'photos/1.jpg';
ejs_photo[1] = 'photos/2.jpg';
ejs_photo[2] = 'photos/3.jpg';
ejs_photo[3] = 'photos/4.jpg';
ejs_photo[4] = 'photos/5.jpg';
ejs_photo[5] = 'photos/6.jpg';
	
function ejs_aff_photos(num)
	{
	if(document.getElementById)
		{
		for(var i=0; i<ejs_photo.length; i++)
		      ejs_fin += "<a href='#' onClick='ejs_aff_photos("+(i+1)+");return(false)'>"+i+" </a>";
		document.getElementById("ejs_photo_box").innerHTML = "<CENTER><IMG SRC='"+ejs_photo[num]+"' BORDER=0><BR>"+ejs_fin+"</CENTER>";
		}
	}
window.onload = new Function("ejs_aff_photos(0)")

</script>
</body>
</html>


mais mon diaporama il n'apparaîit pas

http://forum.exemple.free.fr/ton_diaporama.php

car il dit érreur ligne 23 donc

		      ejs_fin += "<a href='#' onClick='ejs_aff_photos("+(i+1)+");return(false)'>"+i+" </a>";


merci de m'aidé à trouvé l'érreur
Configuration: Windows XP
Internet Explorer 7.0

5 réponses

  1. will.smith Messages postés 230 Date d'inscription   Statut Membre Dernière intervention   10
     
    merci ça marche trés bien

    http://forum.exemple.free.fr/ton_diaporama.php

    mais juste un détaiil es ce qu'on peut enlenvé la barre en bas comme pour souligner car je ne prefere pas qu'il soit souligner les chiffres

    es ce que c'est possible où pas car dans le script il as mis souligner donc je pense que c'est possible d'enlenvé la barre en bas

    merci d'avance pour ton aide
    1
  2. will.smith Messages postés 230 Date d'inscription   Statut Membre Dernière intervention   10
     
    re

    juste pour dre que c'est bon je vais laissé comme ça à part si tu sait comment on enleve la barre du bas où si ce n'est pas possible

    merci d'avance de ton aide

    1
  3. will.smith Messages postés 230 Date d'inscription   Statut Membre Dernière intervention   10
     
    re je pense c'est à causse de la barre en bas qu'il faudras le supprimé

    enfin je pense
    1
  4. dr_fred
     
    pense a initialiser les variables

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Exemple diaporama</title>
    </head>

    <body>
    <DIV ID="ejs_photo_box"></div>
    <SCRIPT LANGUAGE=JavaScript>
    ejs_photo = new Array;
    ejs_photo[0] = '1.jpg';
    ejs_photo[1] = '2.jpg';
    ejs_photo[2] = '3.jpg';
    ejs_photo[3] = '4.jpg';

    function ejs_aff_photos(num)
    {
    var ejs_fin="";
    if(document.getElementById("ejs_photo_box"))
    {
    for(var i=0; i<ejs_photo.length; i++)
    ejs_fin += "<a href='#' onClick='ejs_aff_photos(i+1)'>"+i+" </a>";
    document.getElementById("ejs_photo_box").innerHTML = "<CENTER><IMG SRC='"+ejs_photo[num]+"' BORDER='0'><BR>"+ejs_fin+"</CENTER>";
    }
    }
    window.onload = new Function("ejs_aff_photos(0)")

    </script>
    </body>
    </html>

    chez moi ca marche pas encore comme tu veux mais ton erreur 23 c'était dû au fait que la varialble ejs_fin n'était pas initialisé a vide
    0
  5. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question
  6. will.smith Messages postés 230 Date d'inscription   Statut Membre Dernière intervention   10
     
    re juste j'ai testé avec les photos :

    donc

    http://forum.exemple.free.fr/ton_diaporama.php

    et le code :

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
    <html> 
    <head> 
    <title>Exemple diaporama</title> 
    </head> 
    
    <body> 
    1 er diaparoma :
    <br>
    
    <DIV ID="ejs_photo_box"></div> 
    <SCRIPT LANGUAGE=JavaScript> 
    ejs_photo = new Array; 
    ejs_photo[0] = '1.jpg'; 
    ejs_photo[1] = '2.jpg'; 
    ejs_photo[2] = '3.jpg'; 
    ejs_photo[3] = '4.jpg'; 
    
    function ejs_aff_photos(num) 
    { 
    var ejs_fin="<br />"; 
    if(document.getElementById("ejs_photo_box")) 
    { 
    for(var i=0; i<ejs_photo.length; i++) 
    ejs_fin += "<a href='#' onClick='ejs_aff_photos(i+1)'>"+i+" </a>"; 
    document.getElementById("ejs_photo_box").innerHTML = "<CENTER><IMG SRC='"+ejs_photo[num]+"' BORDER='0'><br />"+ejs_fin+"</CENTER>"; 
    } 
    } 
    window.onload = new Function("ejs_aff_photos(0)") 
    
    
    </script> 
    
    </body>
    </html>
    


    mais le souci si on clique sur le chiffre 3 il ne veut pas mettre la photos 3 il reste toujour sur la 1 er photo

    merci de me dire comment on peut faire
    -1