Bonjour,

j'utilise un script js qui fait un texte défilant ; je connais suffisamment le js pour avoir modifié certaines choses (vitesse défilement, taille et couleur texte, etc.), mais y a un truc que je n'arrive pas à corriger : il y a un petit décalage entre le texte et le conteneur (voir le décalage). Si des experts js peuvent m'aider :
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="fr-fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
 
  <title>Bandeau site ARD anglais</title>
 
 
  <style type="text/css">
.txt_defil {font-size:16px;font-weight:bold;font-family:Arial;color:#000000;text-decoration:none}
.txt_defil:link {font-size:16px;font-weight:bold;font-family:Arial;color:#000000;text-decoration:none}
.txt_defil:visited {font-size:16px;font-weight:bold;font-family:Arial;color:#000000;text-decoration:none}
.txt_defil:hover {font-size:16px;font-weight:bold;font-family:Arial;color:#000000;text-decoration:underline}
  </style>
</head>
 
 
<body>
 
<br>
 
<script language="JavaScript"> <!--
var txt_defil_width = 600; //largeur
var txt_defil_height = 80; //hauteur
var txt_defil_bgcolor = '#11c644'; //couleur de fond
var txt_defil_background = ""; //image de fond
var txt_defil_info = new Array;
txt_defil_info[0]='L\'interface du site de la Documentation a changé, vous pouvez à nouveau faire des recherches dans Eureka. Les conférences en ligne et quelques autres rubriques seront disponibles fin mars.';
//-->
</script>
<script language="JavaScript" src="textdefil_ho1.js"></script>
</body>
</html>
et textdefil_ho1.js :
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
72
73
74
//PLF - http://www.jejavascript.net/
function writext(texdef)
	{
	document.write(texdef);
	}
 
writext('<DIV ID=txt_defil_relativ onMouseOver="txt_defil_stop()" onMouseOut="txt_defil_rstart()" STYLE="position:relative;width:'+txt_defil_width +';height:'+txt_defil_height+';background-color:'+txt_defil_bgcolor+';background-image:url('+txt_defil_background+')">');
writext('<DIV ID=txt_defil_cadre STYLE="position:absolute;width:'+(txt_defil_width )+';height:'+(txt_defil_height)+';top:4;left:4;clip:rect(0 '+(txt_defil_width )+' '+(txt_defil_height)+' 0)">');
writext('<div id=txt_defiler_1 style="position:absolute;width:'+(txt_defil_width )+';left:0;top:0;" CLASS=txt_defil >'+txt_defil_info[0]+'</DIV>');
writext('<div id=txt_defiler_2 style="position:absolute;width:'+(txt_defil_width )+';left:'+txt_defil_width+';top:0;" CLASS=txt_defil >'+txt_defil_info[1]+'</DIV>');
writext('</DIV></DIV>');
 
txt_defil_1 =1;
txt_defil_2 = 0;
stop_mouss=0;
 
function txt_defil_f1()
	{
	if(txt_defil_1 == 1) 
		{
		txt_defil_haut = "txt_defiler_1";
		txt_defil_bas = "txt_defiler_2";
		txt_defil_1 = 0;
		}
	else
		{
		txt_defil_bas = "txt_defiler_1";
		txt_defil_haut = "txt_defiler_2";
		txt_defil_1 = 1;
		}
	txt_defil_nb_info = txt_defil_info.length-1; 
 
	if(txt_defil_2 == txt_defil_nb_info)
		txt_defil_next = 0;
	else
		txt_defil_next = txt_defil_2+1;
 
	if(document.getElementById)
		document.getElementById(txt_defil_bas).innerHTML = txt_defil_info[txt_defil_next];
	txt_defil_left = 0;
	if(document.getElementById)
	txt_defil_f2 ()
	}
 
function txt_defil_f2 ()
	{
if (stop_mouss == 0)
{	
	txt_defil_left -= 2;
	document.getElementById(txt_defil_haut).style.left = txt_defil_left;
	document.getElementById(txt_defil_bas).style.left = txt_defil_left+txt_defil_width;
 
	if((txt_defil_left+txt_defil_width) > 0)
	move2=setTimeout("txt_defil_f2 ()",60)
	else
		txt_defil_f3()
}
else	move1=setTimeout("txt_defil_f2 ()",1000)	
	}
 
function txt_defil_f3()
	{
	txt_defil_2 = txt_defil_next;
	txt_defil_f1()
	}
function txt_defil_stop()
	{
	stop_mouss=1;
	}
function txt_defil_rstart()
	{
	stop_mouss=0;
	}		
window.onload = txt_defil_f1;