Bonjour,

Mon code ci-dessous fait s'afficher simultanément un message et fait déplacer une image. Cependant, le premier message (quotations[0]) ne s'affiche pas lorsque l'image correspondante se déplace (mais après ça les suivants fonctionnent, c'est juste le premier qui ne s'affiche pas) et sous Firefox je reçoit l'avertissement suivant:

Élément référencé par son ID/NAME dans le contexte global. Utilisez la propriété standard du W3C « document.getElementById() » à la place.

Quelqu'un pourrait-il m'aider avec ce problème SVP?

Merci d'avance

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Demo</title>
<script language="JavaScript"> 
 
var quotations = new Array()
			quotations[0]= "Message 0"
			quotations[1]= "Message 1"
			quotations[2]= "Message 2"
 
function cpSequencer(n)
{			
	switch(n)
	{
case 0:
	moveObjLeft(JS, 500, 400, 4); //ID-PX départ-Px fin-Vitesse
	document.getElementById('quotation').innerHTML=quotations[0]
	break;
case 1:
	moveObjLeft(JS, 400, 250, 4); //ID-PX départ-Px fin-Vitesse
	document.getElementById('quotation').innerHTML=quotations[1]
	break;
case 2:
	moveObjLeft(JS, 250, 50, 4); //ID-PX départ-Px fin-Vitesse
	document.getElementById('quotation').innerHTML=quotations[2]
	break;
 
default:
	break;
	}
}
 
i=0;
function moveObjRight(obj, START, END, SPEED) {
   	obj.style.left=START;
   	START+=SPEED;
   	if(START<END) window.setTimeout("moveObjRight(" +obj.id+", " +START+ ", " +END+ ", " +SPEED+ ");", 0);
	else {
		i++;
		setTimeout("cpSequencer(i);",2000)
 
	}
}
function moveObjLeft(obj, START, END, SPEED) {
   	obj.style.left=START;
   	START-=SPEED;
   	if(START>END) window.setTimeout("moveObjLeft(" +obj.id+", " +START+ ", " +END+ ", " +SPEED+ ");", 0);
	else {
		i++;
		setTimeout("cpSequencer(i);",2000)
	}
}
 
</script>
</head>
 
<body>
<table BACKGROUND="bg.png" width="1730" height="736" border="1"><tr><td> 
&nbsp;
</td></tr></table>
 
<p><img id="JS" style="z-index: 0; left: -100px; position: absolute; top: 12px" 
	height=730 width=3 align=baseline border=0 hspace=0 src="image.jpg"></p>
 
<script language="JavaScript"> 
	cpSequencer(0);
</script>
<div id="quotation"></div>
</body>
</html>