Je n'ai pas testé le code en détail mais
*TitreLesson = new Array();
TitreLesson['BookUnUn'] = 'Vocabulaire - Book 1 - Lessons 1 & 2';
TitreLesson['BookUnTrois'] = 'Vocabulaire - Book 1 - Lesson 3';*
Ne fonctionne pas habituellement (je dis cela de tête intuitivement). Lesson
n'est pas un tableau mais un objet JSON ou un dictionnaire (un jeu de clé
valeur:
Je recommande pour cette partie de:
*TitreLesson={'BookUnUn':'Vocabulaire - Book 1 - Lessons 1 & 2',
BookUnTrois':Vocabulaire - Book 1 - Lesson 3' }*
Après on peut effectivement utiliser
*alert (**TitreLesson['BookUnUn'] )* par exemple

Le 18 janvier 2011 10:32, Daniel Cartron <[email protected]> a écrit :

> Le mardi 18 janvier 2011, Laurent a écrit :
> > essaie avec firebug mets un break point dans ta fonction et tu verras
> > les variables definies
> >
> pour l'instant je ne peux l'utiliser j'ai pas la bonne version de firefox,
> je
> fais une mise à jour
>
> Ci dessous un extrait de mon code, avec mes tableaux qui ne sont pas
> exactement pareils que ton exemple, peut-être verras-tu ainsi ce qui cloche
>
> <html>
> <body>
> <script lang=javascript>
>
> var Stade = 1;
> var TitreDebut = '<div style="clear: both; width: 850px;margin: 0em auto;
> font-weight: bold;"><span style="float: left;  width: 168px; text-align:
> center; background:darkred; color:white; margin: 1px;">';
> var LigneDebut = '<div style="clear: both; width: 850px;margin: 0em
> auto;"><span style="float: left;  width: 168px; text-align: center;
> background:
> orange; margin: 1px;";>';
> var LigneFin = '</span></div>';
> var CelluleTitre = '</span><span style="float: left;  width: 168px;
> text-align:
> center;background:darkred; color:white;margin: 1px;">';
> var CelluleLigne = '</span><span style="float: left;  width: 168px;
> text-align:
> center;background:orange;margin: 1px;">';
> var CelluleTraductionTitre = '</span><span style="float: left;  width:
> 338px;
> text-align: center;background:darkred; color:white;margin: 1px;">';
> var CelluleTraductionLigne = '</span><span style="float: left;  width:
> 338px;
> text-align: center;background:orange;margin: 1px;">';
> var ColonnesVerbe = TitreDebut + 'Base verbale' + CelluleTitre + 'Prétérit'
> +
> CelluleTitre + 'Participe passé' + CelluleTraductionTitre + 'Traduction' +
> LigneFin;
> var ColonnesVocabulaire = TitreDebut + 'Anglais' + CelluleTitre + 'Nature'
> +
> CelluleTitre + 'Information' + CelluleTraductionTitre + 'Français' +
> LigneFin;
>
> TitreLesson = new Array();
> TitreLesson['BookUnUn'] = 'Vocabulaire - Book 1 - Lessons 1 & 2';
> TitreLesson['BookUnTrois'] = 'Vocabulaire - Book 1 - Lesson 3';
>
> BookUnUn = new Array();
> BookUnUn[0] = new Array();
> BookUnUn[0][0] = 'about';
> BookUnUn[0][1] = 'préposition';
> BookUnUn[0][2] = '&nbsp;';
> BookUnUn[0][3] = 'à propos de';
> BookUnUn[1] = new Array();
> BookUnUn[1][0] = 'act';
> BookUnUn[1][1] = 'verbe';
> BookUnUn[1][2] = '&nbsp;';
> BookUnUn[1][3] = 'agir';
> BookUnUn[2] = new Array();
> BookUnUn[2][0] = 'act out';
> BookUnUn[2][1] = 'verbe';
> BookUnUn[2][2] = '&nbsp;';
> BookUnUn[2][3] = 'jouer (un rôle)';
> BookUnUn[3] = new Array();
> BookUnUn[3][0] = 'activity';
> BookUnUn[3][1] = 'nom';
> BookUnUn[3][2] = '&nbsp;';
> BookUnUn[3][3] = 'activité';
>
> BookUnTrois = new Array();
> BookUnTrois[0] = new Array();
> BookUnTrois[0][0] = 'ask';
> BookUnTrois[0][1] = 'verbe';
> BookUnTrois[0][2] = '&nbsp;';
> BookUnTrois[0][3] = 'demander';
> BookUnTrois[1] = new Array();
> BookUnTrois[1][0] = 'beach';
> BookUnTrois[1][1] = 'nom';
> BookUnTrois[1][2] = 'pluriel beaches';
> BookUnTrois[1][3] = 'plage';
> BookUnTrois[2] = new Array();
> BookUnTrois[2][0] = 'bus';
> BookUnTrois[2][1] = 'nom';
> BookUnTrois[2][2] = '&nbsp;';
> BookUnTrois[2][3] = 'bus';
> BookUnTrois[3] = new Array();
> BookUnTrois[3][0] = 'car park';
> BookUnTrois[3][1] = 'nom';
> BookUnTrois[3][2] = '&nbsp;';
> BookUnTrois[3][3] = 'stationnement, parking';
> BookUnTrois[4] = new Array();
> BookUnTrois[4][0] = 'corner (at/on the)';
> BookUnTrois[4][1] = 'nom';
> BookUnTrois[4][2] = '&nbsp;';
> BookUnTrois[4][3] = 'coin (au)';
> BookUnTrois[5] = new Array();
> BookUnTrois[5][0] = 'cycle';
> BookUnTrois[5][1] = 'nom';
> BookUnTrois[5][2] = '&nbsp;';
> BookUnTrois[5][3] = 'bicyclette';
>
> function Apprendre(Lesson){
>        Numero = Math.round(Math.random() * (Lesson.length-1));
>        var Exercice = TitreLesson[Lesson];
>        Exercice += ColonnesVocabulaire;
>        Exercice += LigneDebut + Lesson[Numero][0];
>        Exercice += CelluleLigne + Lesson[Numero][1];
>        Exercice += CelluleLigne + Lesson[Numero][2];
>        Exercice += CelluleTraductionLigne + Lesson[Numero][3] + LigneFin;
>        document.getElementById("exercice").innerHTML = Exercice;
> }
>
> </script>
> <a href=# onclick="Apprendre(BookUnUn);" >Exercice 1</a>
> <a href=# onclick="Apprendre(BookUnTrois);" >Exercice 3</a>
> <div id="exercice">
> </div>
> </body>
> </html>
>
> --
> Cordialement, Daniel Cartron
> « Étudiants, étudiantes, ne vous présentez plus au bac : prenez le pont de
> Tancarville. »
> Francis Blanche
> _________________________________
> Linux mailing list
> [email protected]
> http://lists.parinux.org/mailman/listinfo/linux
>
_________________________________
Linux mailing list
[email protected]
http://lists.parinux.org/mailman/listinfo/linux

Répondre à