bonjour,

J'ai un script qui affiche une boite personalisé.
J'utilise quelques fonctions de la librairie prototype.js comme setStyle ou getStyle et Class.create. Cela n'a, je pense aucun impact sur mon problème.
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
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>Site de l'équipe 2</title>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
<script src="prototype.js" type="text/javascript"></script>
<script type="text/javascript">
Popbox = Class.create();
Popbox.prototype = {
	initialize: function pop(elem, code) {
		this.elem = elem;
		this.code = code;
		this.crediv(this.elem, this.code);
		document.getElementById(this.elem).style.display = "";
	},
 
	crediv: function(nomid, texte) {
                wid = 200;
		this.container = document.createElement("div");
		this.container.setAttribute('id', nomid);
		this.container.setStyle({position: "absolute", zIndex: "20"});
		this.container.setStyle({width: wid+'px'});
		this.container.setStyle({fontFamily: "Tahoma, Verdana, Sans Serif", fontWeight: "bold", color: "#444", backgroundColor: "#E88", border: "solid white", borderWidth: "7px 7px 7px 7px", textAlign: "center", padding: "20px 20px 20px 20px"});
		this.footerdiv = document.createElement("div");
		this.footerdiv.setAttribute('id', nomid+"1");
		this.footerdiv.setStyle({position: "absolute", width: wid+54+'px', backgroundColor: "white", textAlign: "right"});	
		document.body.appendChild(this.footerdiv);
		document.body.appendChild(this.container);
 
		l = this.container.getStyle("left");
		t = this.container.getStyle("top");
		this.container.innerHTML = this.code;
		this.CloseLink = document.createElement("a");
		this.CloseLink.setAttribute('href','#');
		this.CloseImage = document.createElement("img");
		this.CloseImage.setStyle({border: "none"});
		this.CloseImage.setAttribute('src', 'fermer2.gif');
		this.CloseLink.appendChild(this.CloseImage);
		this.footerdiv.appendChild(this.CloseLink);
		this.footerdiv.style.left = parseInt(l) + 'px';
		this.footerdiv.style.top = parseInt(t) + 'px';
		fin = parseInt(t) - this.footerdiv.getHeight();
                this.footerdiv.style.top = fin + 1 +'px';
 
	}
}
</script>
</head>
<body>
<div id="menutop">
	<a id="menu" title="essai" href="#" onclick="new Popbox('messag','Ce site est en construction.');">Essai</a>
</div>
</body>
</html>
Jusque là, pas de problème.
Maintenant, je remplace la dernière ligne du script
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
this.footerdiv.style.top = fin + 1 +'px';
par ceci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 
var pe = setInterval(function() {			
this.footerdiv.style.top =  ParseInt(this.footerdiv.style.top) - 1 + 'px';		
if (parseInt(this.footerdiv.style.top) == fin) clearInterval(pe);
}, 1);
La console d'erreur de Firefox me dit :
this.footerdiv has no properties pour la ligne situé dans le setInterval.
J'ai cherché hier toute l'après midi sans succès.
Une idée ??? parceque si this.footerdiv est defini quand il n'y a pas de setInterval, pourquoi il n'est pas défini avec setInterval ???

Merci