Salut tout le monde.
je cherche une solution pour obtenir le même résultat sur IE et Firefox concernant les les propriétés de style top et left.
d'après l'exemple ci dessous, firefox ne reconnait pas top et left.
avez une idée ,une solution ou une autre façon de faire pour ce 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 <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Test doc</title> <script> function change(){ var div0 = document.getElementById("div0"); var div1 = document.getElementById("div1"); alert(div0.style.top); div0.style.left = div1.offsetLeft + document.body.scrollLeft; div0.style.top = div1.offsetTop + document.body.scrollTop; div0.style.width = div1.offsetWidth; div0.style.height = div1.offsetHeight; alert(div0.style.top); } </script> </head> <body> <div id="div1" style="width: 300px; border-color:blue; border-style:solid; border-width:1;"> ***** DIV 1 ****** </div> <div id="div0" style="position: absolute; border-color: red; border-width: 1; border-style: solid; z-index: 10"> ***** DIV 0 ****** </div> <br /><br /> <input type="button" value="test" onclick="change()" /> </body> </html>
Et merci infiniment.
Partager