Salut à tous,
Voilà j'ai un script Javascript qui était intégré dans une page HTML par une balise <script>. Il marchait très bien sur FF et sur IE. Et j'ai décidé de le mettre dans un fichier à part (le validateur W3C n'aime pas les &&). J'ai mis exactement le même script mais là maintenant autant il marche toujours très bien avec FF, autant il marche plus du tout avec IE. Voici le code orginal :Le fichier contenant mon nouveau code est à l'adresse suivante : http://effiix.fr.nf/Allemagne/Stuttg...uttgartpano.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 <SCRIPT type="text/javascript"> var ie=document.all var ns6=document.getElementById&&!document.all function ietruebody(){ return (document.compatMode!="BackCompat")? document.documentElement : document.body } function zoom2(which, e, position, imgwidth, imgheight){ if (ie||ns6){ crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage // ICI POUR REGLER LA POSITION DE LA LOUPE PAR RAPPORT A LA PAGE crossobj.style.left=0+"px" crossobj.style.top=80+"px" crossobj.innerHTML='<div align="left" id="dragbar" class="txt-bold"><span id="closetext" onClick="closepreview()">» Fermer</span></div><img src="'+which+'">' crossobj.style.visibility="visible" return false } else //if NOT IE 4+ or NS 6+, affiche image ds le navigateur en pleine page return true } function closepreview(){ crossobj.style.visibility="hidden" } function drag_drop(e){ if (ie&&dragapproved){ crossobj.style.left=tempx+event.clientX-offsetx+"px" crossobj.style.top=tempy+event.clientY-offsety+"px" } else if (ns6&&dragapproved){ crossobj.style.left=tempx+e.clientX-offsetx+"px" crossobj.style.top=tempy+e.clientY-offsety+"px" } return false } function initializedrag(e){ if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){ offsetx=ie? event.clientX : e.clientX offsety=ie? event.clientY : e.clientY tempx=parseInt(crossobj.style.left) tempy=parseInt(crossobj.style.top) dragapproved=true document.onmousemove=drag_drop } } document.onmousedown=initializedrag document.onmouseup=new Function("dragapproved=false") </SCRIPT> <SCRIPT type="text/javascript"> // position loupes var navig= navigator.appCodeName; //alert(navig); if (document.all){ document.write('<style type="text/css">#showloupe1{margin-left:8;margin-top:114;position:absolute;visibility:visible;)</style>'); document.write('<style type="text/css">#showloupe2{margin-left:8;margin-top:112;position:absolute;visibility:visible;)</style>'); document.write('<style type="text/css">#showloupe3{margin-left:8;margin-top:114;position:absolute;visibility:visible;)</style>'); } if (!document.all){ document.write('<style type="text/css">#showloupe1{margin-left:8;margin-top:41;position:absolute;visibility:visible;)</style>'); document.write('<style type="text/css">#showloupe2{margin-left:8;margin-top:39;position:absolute;visibility:visible;)</style>'); document.write('<style type="text/css">#showloupe3{margin-left:8;margin-top:41;position:absolute;visibility:visible;)</style>'); } if (ns6){ document.write('<style type="text/css">#showloupe1{margin-left:8;margin-top:114;position:absolute;visibility:visible;)</style>'); document.write('<style type="text/css">#showloupe2{margin-left:8;margin-top:112;position:absolute;visibility:visible;)</style>'); document.write('<style type="text/css">#showloupe3{margin-left:8;margin-top:114;position:absolute;visibility:visible;)</style>'); } </SCRIPT>
A priori il n'y a pas de problème de chemin durant l'appel du script avec IE, car j'ai essayé d'insérer des alert et elles sont effectivement affichées.
Merci pour vos solutions.
Partager