bonjour,
j'aimerais changer du texte dans une balise <p>
pour ça j'utilise "document.getElementById('bloc').innerHTML= variable;" et ça marche très bien tant que je n'utilise pas un tableau pour stocker mon texte.
j'en déduis que j'ai du mal déclarer mon tableau, mais je ne trouve pas l'erreur : /
merci pour votre aide.
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
27
28
29
30 var tab_image = new Array(3); for (var i=0; i< tab_image.length;i++) tab_image[i] = new Image(); tab_image[0].src='photo/photo1.jpg'; tab_image[1].src='photo/photo2.jpg'; tab_image[2].src='photo/photo3.jpg'; var text = new array(3); text[0] = ".........."; text[1] = "__________"; text[2] = "*************"; var n=0; function next() { n= ++n; if (n == tab_image.length) n=0; window.document.move.src=tab_image[n].src; document.getElementById('bloc').innerHTML= text[n]; } function prec() { n= --n; if (n == -1) n=1; window.document.move.src=tab_image[n].src; document.getElementById('bloc').innerHTML= text[n]; }
Partager