bonjour,
comme l'a dit le titre j'ai une fonction js et je veux quelle démarre lorsque la page se charge, sous ff elle ne fonctionne pas mais sous ie fonctionne trés bien
meme chose pour onmouseover lorsque je l'essaie
je me suis bloqué
merci
bonjour,
comme l'a dit le titre j'ai une fonction js et je veux quelle démarre lorsque la page se charge, sous ff elle ne fonctionne pas mais sous ie fonctionne trés bien
meme chose pour onmouseover lorsque je l'essaie
je me suis bloqué
merci
Salut,
Nous ne sommes pas devins, aide-nous à t'aider. Poste un code (X)HTML/CSS/Javascript simplifié au maximum n'illustrant que ton problème.
Exemple :
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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>modèle de code pour bien poster</title> <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> <style type="text/css"> /* code css */ </style> </head> <body> <!-- code xhtml --> <script type="text/javascript"> <!-- // code javascript //--> </script> </body> </html>
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 <html> <head> <title>News</title> <style type="text/css" > <!-- .top{ background-image:url(admin/image/design/top.gif); background-repeat:repeat-x; height:100%; width:100%; } .bottom{ background-image:url(admin/image/design/bottom.gif); background-repeat:repeat-x; background-position:bottom; height:100%; width:100%; } .left{ background-image:url(admin/image/design/left.gif); background-repeat:repeat-y; height:100%; width:100%; } .right{ background-image:url(admin/image/design/right.gif); background-repeat:repeat-y; background-position:right; height:100%; width:100%; } .topLeft{ background-image:url(admin/image/design/topLeft.gif); background-repeat:no-repeat; height:100%; width:100%; } .topRight{ background-image:url(admin/image/design/topRight.gif); background-repeat:no-repeat; background-position:top right; height:100%; width:100%; } .bottomLeft{ background-image:url(admin/image/design/bottomLeft.gif); background-repeat:no-repeat; background-position:bottom left; height:100%; width:100%; } .bottomRight{ background-image:url(admin/image/design/bottomRight.gif); background-repeat:no-repeat; background-position:bottom right; height:100%; width:100%; } .marque{ width:206px; position:relative; margin-top:5px; } .cadre_marq{ width:206px; margin:0px; } div#conteneur div.posrelative { width:205px; POSITION: relative; text-align:center; } #conteneur { OVERFLOW: hidden; CLIP: rect(0px 250px 200px 0px); WIDTH: 193px; height: 155px; position:absolute; left: 6px; top: 7px; } //--> </style> <script language="JavaScript" src="scroll.js"></script> <script language="JavaScript" type="text/javascript"> <!-- var MyBox = null; function Init() { MyBox = new Box('MyBox', 'conteneur', 1, 100, 2000, 10); MyBox.start(); } //--> </script> </head> <body onLoad="Init();"> <div class="marque"> <div class="cadre_marq" ><div class="top" ><div class="bottom" ><div class="left" ><div class="right" ><div class="topLeft" ><div class="topRight" ><div class="bottomLeft" ><div class="bottomRight" > <table border=0 CELLSPACING=0 CELLPADDING=0> <tr> <td width=205 height=170><spacer type="block" width=205 height=170></td> </tr> </table> <DIV ID="conteneur" onMouseOver="MyBox.stop();" onMouseOut="MyBox.start();"> <DIV ID="info1" class="posrelative"> <A HREF="http://www.pneu-amine.com.tn"> <IMG class="posrelative" SRC="marque/amine.png" title="www.pneu-amine.com.tn" border=0></A><hr /></DIV> <DIV ID="info1" class="posrelative"> <A HREF="http://www.barum-online.com"> <IMG class="posrelative" SRC="marque/BARUM.jpg" title="www.barum-online.com" border=0></A><hr /></DIV> <DIV ID="info1" class="posrelative"> <A HREF="http://www.bkt-tires.com"> <IMG class="posrelative" SRC="marque/bkt.jpg" title="www.bkt-tires.com" border=0></A><hr /></DIV> <DIV ID="info1" class="posrelative"> <A HREF="http://www.marangoni.com"> <IMG class="posrelative" SRC="marque/Marangoni.jpg" title="www.marangoni.com" border=0></A><hr /></DIV> <DIV ID="info1" class="posrelative"> <A HREF="http://www.makwheels.it"> <IMG class="posrelative" SRC="marque/logo.jpg" title="www.makwheels.it" border=0></A><hr /></DIV> <DIV ID="info1" class="posrelative"> <A HREF="http://www.uniroyal-online.com"> <IMG class="posrelative" SRC="marque/uniroyal.png" title="www.uniroyal-online.com" border=0></A><hr /></DIV> <DIV ID="info1" class="posrelative"> <A HREF="http://www.maxxis.com"> <IMG class="posrelative" SRC="marque/maxiis.png" title="www.maxxis.com" border=0></A><hr /></DIV> </DIV> </div></div></div></div></div></div></div></div ></div> </div> </div> </body> </html>
Le problème vient de MyBox, cette fonction affiche bien une alerte au chargement de la page :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 function Init() { alert("blah"); MyBox = new Box('MyBox', 'conteneur', 1, 100, 2000, 10); MyBox.start(); }
oui exactement ca affiche,
mais ou est le probleme de mybox
mais le prob c'est qu'il ne marche pas sous ff et fonctionne sous ie
voici le code scroll.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212 <!-- /* Copyright 2001 : Atout Développement */ /* Auteur : Yvan Vanwynsberghe */ var ns4 = (document.layers)? true:false; //NS 4 var ie4 = (document.all)? true:false; //IE 4 var dom = (document.getElementById)? true:false; //DOM function GetNS4Object(MyID,MyDocument) { var MyObject= eval('MyDocument.'+MyID); if (!(MyObject)) for(var i=0;i<MyDocument.layers.length;i++) { MyObject = GetNS4Object(MyID,MyDocument.layers[i].document); if (MyObject) break; } return MyObject; } function GetObject(MyID) { if (dom) return document.getElementById(MyID); if (ie4) return document.all[MyID]; if (ns4) return GetNS4Object(MyID,window.document); return 0; } function GetCSS(MyObject) { if (dom || ie4) return MyObject.style; else if (ns4) return MyObject; else return 0; } function GetHeight(MyObject) { if (dom || ie4) return MyObject.offsetHeight; else if (ns4) return MyObject.clip.height; else return 0; } function GetWidth(MyObject) { if (dom || ie4) return MyObject.offsetWidth; else if (ns4) return MyObject.clip.width; else return 0; } function GetTop(MyObject) { if (dom || ie4) return (MyObject.offsetTop); if (ns4) return MyObject.y; return 0; } function GetLeft(MyObject) { if (dom || ie4) return MyObject.offsetLeft; if (ns4) return MyObject.x; return 0; } function MoveObject(myX,myY) { this.X = myX; this.Y = myY; this.CSS.left=this.X; this.CSS.top=this.Y; } function MoveObjectUp(mystep) { this.Y -= mystep; this.CSS.top=this.Y; } function MoveObjectDown(mystep) { this.Y += mystep; this.CSS.top=this.Y; } function CreateObject(DivId,MyObject) { if (MyObject) this.Object = MyObject; else this.Object = GetObject(DivId); if (this.Object) { this.CSS = GetCSS(this.Object); this.Height = GetHeight(this.Object); this.Width = GetWidth(this.Object); this.X = GetTop(this.Object); this.Y = GetLeft(this.Object); this.Move = MoveObject; this.Up = MoveObjectUp; this.Down = MoveObjectDown; } return this; } function DelTextNode(MyObject) { var node = MyObject.firstChild; var next; while (node) { next = node.nextSibling; if (node.nodeType == 3) MyObject.removeChild(node); node = next; } } function CreateChildren(MyObject,HoriSpacer,VertSpacer) { var i=0; var MyChildren = new Array(); if (dom) { DelTextNode(MyObject); for (i=0;i<MyObject.childNodes.length;i++) { MyChildren[i] = new CreateObject(0,MyObject.childNodes[i]); MyChildren[i].Move(i*HoriSpacer,i*VertSpacer); } return MyChildren; } if (ie4) { for (i=0;i<MyObject.children.length;i++) { MyChildren[i] = new CreateObject(0,MyObject.children(i)); MyChildren[i].Move(i*HoriSpacer,i*VertSpacer); } return MyChildren; } if (ns4) { for (i=0;i<MyObject.document.layers.length;i++) { MyChildren[i] = new CreateObject(0,MyObject.layers[i]); MyChildren[i].Move(i*HoriSpacer,i*VertSpacer); } return MyChildren; } } function ScrollUp() { var MyInterval = this.Interval1; this.stop(); if (this.Children[this.FirstChildren].Y<-this.threshold) { MyInterval = this.Interval2; this.Children[this.FirstChildren].Down(this.TotalHeight); if (this.FirstChildren<this.Children.length-1) { this.FirstChildren++; this.threshold += this.Children[this.FirstChildren].Height; } else { this.FirstChildren = 0; this.threshold = this.Children[this.FirstChildren].Height+this.Spacer; } } for (var i=0;i<this.Children.length;i++) { this.Children[i].Up(this.Step); } this.ProcessId = setTimeout(this.name + '.start()', MyInterval); } function ScrollStop() { if (this.ProcessId) clearTimeout(this.ProcessId); this.ProcessId = null; } function Box(BoxName, DivId, myStep, myTempo1, myTempo2, mySpacer) { this.name = BoxName; this.Step = myStep ? myStep : 1; this.Interval1 = myTempo1 ? myTempo1 : 100; this.Interval2 = myTempo2 ? myTempo2 : 100; this.Spacer = mySpacer ? mySpacer : 0; this.ProcessId = null; this.Container = new CreateObject(DivId); this.Children = new CreateChildren(this.Container.Object,0,mySpacer); this.FirstChildren = 0; this.LastChildren = this.Children.length-1; this.threshold = this.Children[0].Height+this.Spacer; var myHeight = 0; for (var i=0;i<this.Children.length;i++) { myHeight += (this.Children[i].Height + this.Spacer); } this.TotalHeight = myHeight; this.Container.visibility = 'visible'; } Box.prototype.start = ScrollUp; Box.prototype.stop = ScrollStop; //-->
bonjour,
déjà dans la partie CSS :
écris en minuscules le nom des styles.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 #conteneur { OVERFLOW: hidden; CLIP: rect(0px 250px 200px 0px); WIDTH: 193px;
Ensuite je me demande si le style clip existe
Regarde également la console d'erreurs de FF (outils -> console d'erreur) et poste les messages s'il y en a.
Bonjour,
J'utilise aussi ce script javascript.
Il fonctionnait très bien jusqu'à ce que j'essaye de respecter les normes W3C:depuis, le script fonctionne avec IE, mais plus avec FF.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Le pb ne vient pas du onload ni du onmouseover (le test avec alert() fonctionne), je penche plutot pour un pb de compatibilité dans le code.
Ca fait un moment que je cherche et je n'ai pas encore trouvé.
Partager